From fb6c66f7d1113b463bcbd20ffd5656eb35be778d Mon Sep 17 00:00:00 2001 From: marco-link <31407440+marco-link@users.noreply.github.com> Date: Wed, 21 Apr 2021 10:14:41 +0200 Subject: [PATCH] pull from cmssw/master (#2) * Code check * Add PPS geometry and simulation tags to GTs * Changing the proton propagator to the Optical Function method * Revert back to standard naming for Phase1 classes * Fixed include guards * Adding the new filter modules * Code format * Remove unused debug for-loop. * Adding the multiple daughters of same kind possibility * Use esConsumes for geometry and ETTmap records. * Codecheck update * Fix the deug statements * use old hadronic physics * Correcting the clang build err - corrected splelling in header guard * fixed compilation * add 14 TeV VBF H>inv pythia cfg * added update on low-energy GFlash * fix issues with clang tidy and static analyzer * First skeleton of a Trackster from Simcluster producer * Fix bug * Add simtracksters into the event content * Make SimTracksters part of TICL Tasks * Create a SimTrackster per SimCluster * Deleted methods should be public * keep multiclusters from simtracksters * cleanup * add multiclusters from simtrackstrs * add simtracksters to validation * Make multiplicity take the simulated energy fraction * add simTracksters iteration to validation * replacing tabs with spaces and speeding up --help * make enabling simclusters validation plots * cleanup * Add SimTracksters to FEVT and PreValidation Sequence * Fix for premix wf * get ES data through token * update and reorder BuildFile * adding missing dependencies in BuildFile * Patatrack integration - Pixel workflows (12/N) (#31854) * Add workflows for Riemann fit and GPU (cms-patatrack#20) * add `riemannFit` and `gpu` modifiers and workflows for Riemann fit and GPU modules * switch GPU modules with `gpu` modifier * Add a DQM sequence for pixel-only tracking (cms-patatrack#23) * add a DQM sequence for pixel-only tracking * add pixelTrackingOnlyDQM sequences to the pixelTrackingOnly workflows * add pixelTrackingOnlyDQM sequences to the riemannFit and gpu workflows * Synchronise with CMSSW_10_1_0_pre2 * Synchronise with CMSSW_10_1_0_pre3 * Synchronise with CMSSW_10_1_0 * Synchronise with CMSSW_10_2_0_pre1 * Synchronise with CMSSW_10_2_0_pre2 * Synchronise with CMSSW_10_2_0_pre3 * Synchronise with CMSSW_10_2_0_pre4 * Synchronise with CMSSW_10_2_0_pre5 * Port the Riemann fit to CUDA (cms-patatrack#60) - the CPU Riemann fit works using all combinations between the 2 booleans: `useErrors` and `useMultipleScattering`; - the standalone version of the GPU Riemann fit has been updated in order to explore all possibilities among the 2 booleans above: all of them work and produce identical results up to 1e-5 precision (the default one, 1e-6 fails when enabling multiScattering, most likely due to matrix inversions); - the GPU version of the Riemann fit within CMSSW works, with 1 fit assigned to each thread, with 32 threads/warps, all dynamically computed. Things that needs a "hack": - limit the "dynamic" size of Eigen matrices to at most, 4x4, which is just fine for quadruplets. Using anything wider will cause errors which I *believe* is related to the stack size of threads on the GPU; - cast matrices to be inverted to 4x4 (was done before the previous point: will revert it back and see if that's still needed or not, but I believe it is); this was done in order to "specialize" the `invert()` call to something that is "natively" supported by Eigen on GPU (that brought in also few `__host__` `__device__` here and there in Eigen); - fix the alignment of the `struct` holding the results of the fit, since its size was different on GPU and CPU, causing an annoying off-by-one effect. * Synchronise with CMSSW_10_2_0_pre6 * update relval input strings (102X) * Synchronise with CMSSW_10_2_0 * adding NANO step to 2018 MC workflows * Merge pull request #24024 from prebello/from-CMSSW_10_2_X_2018-07-24-2300 update relval input strings (102X) * Synchronise with CMSSW_10_2_2_patch1 * activate the new SiStripCalSiStripCalBiasScan in the matrix test * Add pixel tracking workflows for data (cms-patatrack#144) * add HEM-15-16 relval workflows * introduce RelVal for hybrid emulation (with ZS10 repacking),HLT-like zero-suppression (with normal ZS repacking),RECO of 2015 PbPb VirginRaw data * add 3 production workflows for premix2018 * Merge pull request #24550 from zhenhu/add-HEM-15-16-relvals_102X [10.2.X] add HEM-15-16 relval workflows * Merge pull request #24618 from zhenhu/addPremixProdWfs_102X backport [10.2.X] add 3 production workflows for premix2018 * Synchronise with CMSSW_10_2_5 * Synchronise with CMSSW_10_2_6 * Synchronise with CMSSW_10_4_0_pre2 * Synchronise with CMSSW_10_4_0_pre3 * Synchronise with CMSSW_10_4_0_pre4 * Synchronise with CMSSW_10_4_0 * Change GPU workflow numbering: .7->.51, .8->.52, .9->.53 (cms-patatrack#259) * Synchronise with CMSSW_10_5_0_pre1 * Synchronise with CMSSW_10_5_0_pre2 * Synchronise with CMSSW_10_6_0_pre2 * Rework the Riemann fit and broken line fit (cms-patatrack#338) Merge the Riemann and broken line fits into single configurable pixel n-tuplet fitter, and extend it to work with up to 5 hits. Mmake the broken line fit the default algorithm. Try both triplets and quadruplets in the pixel "hole". Limit pT used to compute the multple scattering. Use the inline Cholesky decomposition. Generic clean up and improvements. * Synchronise with CMSSW_10_6_0 * Synchronise with CMSSW_11_0_0_pre7 * Fix broken merge in Configuration/PyReleaseValidation * Synchronise with CMSSW_11_0_0_pre11 * Update and extend the Patatrack workflows Update the definition of the Patatrack workflows to avoid conflicts in CMSSW_11_0_0_pre12: - renumber to avoid conflicts with #27392 - reimplement the definition following #28281 - add Z->mumu 2018 realistic workflows - add TTbar and Z->mumu 2021 realistic workflows - move the data workflows to 2018D, HLTPhysics and JetHT * Synchronise with CMSSW_11_0_0_pre13 * Backport: add ECAL-only workflows for 2018 data (#30105) * Add tracking-only and pixel tracking-only workflows for Run 3 (#30338) * Backport: add ECAL-only and HCAL-only workflows for MC and data (#30350) Backport #30105: add ECAL-only workflows for data. Backport #30136: add HCAL-only workflows for MC and data. * Synchronise with CMSSW_11_2_0_pre2 * Update the RelVal workflows and the CPU customisation (cms-patatrack#549) Update the RelVal workflows and the CPU customisation: - change the .501 workflow to run the full Patatrack pixel track reconstruction on CPU - add a customisation to run the Patatrack reconstruction with triplets, on CPU and GPU - add the .505 and .506 workflows to reconstruct triplets, on CPU and GPU Co-authored-by: Andrea Bocci * Synchronise with CMSSW_11_2_0_pre8 * Synchronise with CMSSW_11_2_0_pre9 * Synchronise with CMSSW_11_2_0_pre10 * Backport: add RecoFakeHLT steps to 2018 Patatrack WFs to enable GPU modifiers (#32333) The 2018 GPU matrix WFs (10824.502, 10824.512, 10824.522, 10842.502) produced the same cmsDriver configurations as their CPU counterparts. This PR fixes this by setting the gpu modifier also for the RecoFakeHLT step. * Synchronise with CMSSW_11_3_0_pre1 * Synchronise with CMSSW_11_3_X_2020-12-24-2300 * Document the new Pixel workflows Co-authored-by: Matti Kortelainen Co-authored-by: Marco Rovere Co-authored-by: Patricia Co-authored-by: Francesco Co-authored-by: cmsbuild Co-authored-by: mmusich Co-authored-by: zhen Co-authored-by: Vincenzo Innocente Co-authored-by: Mariarosaria D'Alfonso Co-authored-by: AdrianoDee Co-authored-by: Thomas Reis * Remove CLCT BX and LCT BX comparisons * add valueMap producer for the track distances * add monitoring of closest track * use CTPPSRun2Geometry customization to fix HLT test with Run2 data * use the iEvent.getHandle syntax and make TrackDistanceValueMapProducer a global EDProducer * Use 112X geometry in online data global tags * Use 112X geometry in offline data global tags * fix in CTPPSRun2Geometry cust funt * fix in CTPPSRun2Geometry cust funt * fix HLT addOnTest to use CTPPSRun2Geometry custom funct * Disable the deug possibility * add 14 tev gluino model * Remove trackingMaterialGroups_ForPhaseII.xml from T25/T26 dict * add comment to deprecate Multiclusters * add name and date * Modernize code and simplify * add the possibility to save only the first nth closest track distances * fix container size * Add a new workflow with V15 version of HGCal Geometry * Modify Run3 workflows with changed version of RP devices * add spaces * Change nodigis to hasdigis * Hit counter for shower trigger * Use constants from CSCConstants * Use constants from CSCConstants * Added ZpEE and ZpMM 14TeV fragments * Use auto * Migrate EcalTPCondAnalyzer to use esConsumes and replace couts with LogVerbatim. * Move CSCConstants.h to DataFormats/CSCDigi * Better document the wiregroups * Delete particleFlowBadHcalPseudoCluster_cff.py Was added by accident instead of RecoParticleFlow/PFClusterProducer/python/particleFlowBadHcalPseudoCluster_cff.py * migrate DQM/TrackingMonitor to esConsumes * Move plugin out of SimDataFormats * Fix the memory error * Code format * First skeletton of the harvester * Added skeletton for the worker * Starting to populate a few monitors * Making use of detid's naming export features * Updated to the new PPS DataFormat accessors * Stripping the histogram containers from worker * Using rechits instead of digis * Filling the condition on pixel tracks * Full implementation of pixels tracks selection stage * Corrected RP station and pixel tracks cuts retrieval * Starting to integrate geometry * Full usage of db-loaded geometry for channels booking, starting to fill the harvester * Dropped CLHEP dependency * Also storing uncalibrated ToT distribution, first attempt to fit the t-vs-tot profile in harvester * Applied code-format * Inserted PPSTimingCalib selection/paths/output sequences in their right place * Delete ME file after copy * Small cleanup, filtered stream renaming * Reverted back filtered stream name * Matched new folders hierarchy * Updated paths * Added Geometry/Records to TimingCalibration build * Added an uncalibrated/calibrated collection of diamond information * PPS track filter stripped from PCL worker * Added a test sequence wrapping up all PCL operations * Cleanup * Per-pot track filter for PPS * More C++-friendly tracks counting * Replaced the track filter by the HLT-defined one * Cleanup * Cleanup of timing calibration worker sequence * Keeping the diamond digis instead of rechits to perform uncalibrated rechits "reconstruction" * Cleanup of harvester includes * Using a smart pointer to hold x-profile used in calibration fit * Ensure PoolDBService is available before processing * Delegating DB service availability check at plugin constructor level * Avoiding a couple of try/catch blocks through CTPPSDiamondDetId::check * Filters rules retrieved by reference instead of copies * Thread-safe geometry retrieval from ES * Code-format * Dropping the DB service private attribute to create it at constructor and for each end job * Transition type set for geometry consumes declaration * Thread-safe ES geometry condition retrieval for PCL harvester * Update CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py Co-authored-by: Silvio Donato * Update CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py Co-authored-by: Silvio Donato * Cloning instead of deep-copying, Task/Sequence redefinition of the filtering/worker modules * Replaced back ','s with '*'s for seqALCARECOPPSCalTrackBasedSel Sequence * Using a reco task instead of a sequence for the taskALCARECOPPSTimingCalib task definition * PCL WF test is now 1041 * Apply changes from : scram build code-checks / code-format * use references * Correct validation code for MB of HCAL * Code check * Utilize a phase2 scenario for testing dd4hep scenarios * Clarify number of strips and half-strips * Tighten assert statements * put distrip and cfeb calculation in functions * Fix typo * Check in more detail the content of teh geometry * Code check * Clean BuildFiles * rename and small fixes * CLANG test * cleanup of Track analyzer moving double loop to dqm harvester * remove commented lines * remove unwanted includes and cout usage * remove duplicate includes and cout * resolve code check issues * Move the macros to a separate directory and adopt for dd4hep * Tryto fix * change logic in folded occupancy client to allow running for cosmics;update cosmics config * Code check * update HI sequence * apply coding style * reorganization in configs * Add step3 and 4 for TICL only * Move check for pixel active area into RectangularMTDTopology, make it usable for BTL as well * Fix post merge compilation errors * Code format * Fix indentation in EDAlias python dump * Add a new scenario D84 same as D70 but with updated tracker T24 * updated physics to 10.7 * removed obsolete * removed remaining obsolete * complete update * complete update * clean-up custom physics * code-checks * code-checks * update input file in fwliteWithPythonConfig_cfg.py * Remove dead essignments from L1Trigger/CSCTrackFinder * Suggestions by Andrea Perrotta * Suggestions by Andrea Perrotta * Modified version of EB numbering scheme code which will work with modified EB algorithm * deal with fastsim issue raised in #33430 * Code check * Update python tests - py3 only * Code format * use python3 for all tests * Minor changes in the configs removing uneeded loads in view of the new GT * uncommented the verbosity line and changed the names * fixed the names * correct for gen fragment naming conventions * remove old cfgs Co-authored-by: Sunanda Co-authored-by: Helena Co-authored-by: cmsbuild Co-authored-by: Luiz Mundim Co-authored-by: Davide Valsecchi Co-authored-by: Aravind Co-authored-by: Thomas Reis Co-authored-by: Vladimir Co-authored-by: Vincenzo Innocente Co-authored-by: Silvio Co-authored-by: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Co-authored-by: mmusich Co-authored-by: Felice Co-authored-by: Andrea Bocci Co-authored-by: Matti Kortelainen Co-authored-by: Marco Rovere Co-authored-by: Patricia Co-authored-by: Francesco Co-authored-by: zhen Co-authored-by: Mariarosaria D'Alfonso Co-authored-by: AdrianoDee Co-authored-by: Sven Dildick Co-authored-by: Chris West Co-authored-by: Adinda de Wit Co-authored-by: Andrea Co-authored-by: namppl Co-authored-by: laurenhay Co-authored-by: Leonardo Cristella Co-authored-by: Laurent Forthomme Co-authored-by: Laurent Forthomme Co-authored-by: Carlo Battilana Co-authored-by: Jonas Rembser Co-authored-by: Suvankar Roy Chowdhury Co-authored-by: Erica Brondolin Co-authored-by: Fabio Cossutti Co-authored-by: Mircho Rodozov Co-authored-by: Mircho Nikolaev Rodozov --- .../plugins/BuildFile.xml | 1 - .../plugins/LaserOpticalPhysics.cc | 4 +- CUDADataFormats/HGCal/BuildFile.xml | 6 +- .../interface/gpuClusteringConstants.h | 12 - .../Track/interface/TrackSoAHeterogeneousT.h | 2 +- .../interface/TrackingRecHit2DHeterogeneous.h | 12 +- .../interface/TrackingRecHit2DSOAView.h | 5 +- .../EcalLaserAnalyzer/interface/TFParams.h | 18 +- .../EcalLaserAnalyzer/interface/TMCReader.h | 81 +- .../EcalLaserAnalyzer/interface/TMConfig.h | 136 +- .../EcalLaserAnalyzer/interface/TMEGeom.h | 93 +- .../EcalLaserAnalyzer/interface/TMatacq.h | 7 +- .../interface/TPEDestalAnalysis.h | 50 +- .../EcalLaserAnalyzer/interface/TPNFit.h | 5 +- .../EcalLaserAnalyzer/interface/TSFit.h | 17 +- .../interface/TShapeAnalysis.h | 5 +- .../EcalTPGTools/interface/EcalReadoutTools.h | 12 +- .../plugins/EcalTPGParamBuilder.cc | 51 +- .../EcalTPGTools/src/EcalReadoutTools.cc | 11 +- .../interface/TimingCalibrationStruct.h | 17 + .../TimingCalibration/plugins/BuildFile.xml | 9 + .../PPSTimingCalibrationPCLHarvester.cc | 160 + .../plugins/PPSTimingCalibrationPCLWorker.cc | 126 + .../ALCARECOPPSCalTrackBasedSel_Output_cff.py | 15 + .../python/ALCARECOPPSCalTrackBasedSel_cff.py | 48 + .../ALCARECOPPSTimingCalib_Output_cff.py | 13 + .../python/ALCARECOPPSTimingCalib_cff.py | 28 + .../PPSTimingCalibrationHarvester_cff.py | 4 + Calibration/HcalCalibAlgos/macros/CalibCorr.C | 6 +- .../HcalCalibAlgos/macros/CalibFitPlots.C | 490 ++- .../HcalCalibAlgos/macros/CalibMonitor.C | 8 +- .../macros/CalibPlotProperties.C | 83 +- Calibration/HcalCalibAlgos/macros/CalibTree.C | 6 +- .../plugins/HcalIsoTrkAnalyzer.cc | 2 +- .../HcalCalibAlgos/test/HcalIsoTrackStudy.cc | 183 +- .../plugins/AlcaPCCProducer.cc | 68 +- .../TkAlCaRecoProducers/plugins/BuildFile.xml | 23 + .../plugins/NearbyPixelClustersAnalyzer.cc | 558 +++ .../plugins/NearbyPixelClustersProducer.cc | 438 +++ .../plugins/TrackDistanceValueMapProducer.cc | 150 + ...ECOSiPixelCalSingleMuonLoose_Output_cff.py | 16 + .../ALCARECOSiPixelCalSingleMuonLoose_cff.py | 34 + ...ECOSiPixelCalSingleMuonTight_Output_cff.py | 17 + .../ALCARECOSiPixelCalSingleMuonTight_cff.py | 99 + ...ALCARECOSiPixelCalSingleMuon_Output_cff.py | 5 +- .../ALCARECOSiPixelCalSingleMuon_cff.py | 16 +- .../python/NearbyPixelClustersProducer_cfi.py | 8 + .../TrackDistanceValueMapProducer_cfi.py | 7 + .../test/inspectNearByPixelClusters_cfg.py | 95 + .../interface/EcalTPGOddWeightGroupHandler.h | 95 + .../interface/EcalTPGOddWeightIdMapHandler.h | 90 + .../Ecal/interface/EcalTPGTPModeHandler.h | 88 + CondTools/Ecal/python/copyTPMode_cfg.py | 59 + CondTools/Ecal/python/copyWOddGroup_cfg.py | 59 + CondTools/Ecal/python/copyWOddIdMap_cfg.py | 59 + .../Ecal/src/EcalTPGOddWeightGroupHandler.cc | 444 +++ .../Ecal/src/EcalTPGOddWeightIdMapHandler.cc | 392 +++ CondTools/Ecal/src/EcalTPGTPModeHandler.cc | 388 +++ Configuration/AlCa/python/autoAlca.py | 4 +- Configuration/AlCa/python/autoCond.py | 28 +- Configuration/AlCa/python/autoPCL.py | 3 +- .../Eras/python/Era_Run2_2016_cff.py | 3 +- .../Eras/python/Era_Run2_2017_cff.py | 3 +- .../Eras/python/Era_Run2_2018_pp_on_AA_cff.py | 3 +- ...Run2_2018_pp_on_AA_noHCALmitigation_cff.py | 5 +- ...itigation_cff.py => Modifier_ctpps_cff.py} | 3 +- .../Modifier_pf_badHcalMitigationOff_cff.py | 3 + .../python/AlCaRecoOutput_RelVal_cff.py | 2 + .../EventContent/python/AlCaRecoOutput_cff.py | 10 +- .../EventContent/python/EventContent_cff.py | 8 +- ...1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py | 271 ++ .../VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py | 29 + .../ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py | 51 + .../ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py | 51 + Configuration/Geometry/README.md | 6 + .../GeometryDD4hepExtended2026D82Reco_cff.py | 62 + .../GeometryDD4hepExtended2026D82_cff.py | 18 + .../GeometryDD4hepExtended2026D83Reco_cff.py | 59 + .../GeometryDD4hepExtended2026D83_cff.py | 16 + .../GeometryDD4hepExtended2026D84Reco_cff.py | 60 + .../GeometryDD4hepExtended2026D84_cff.py | 16 + .../python/GeometryExtended2026D82Reco_cff.py | 62 + .../python/GeometryExtended2026D82_cff.py | 16 + .../python/GeometryExtended2026D83Reco_cff.py | 59 + .../python/GeometryExtended2026D83_cff.py | 14 + .../python/GeometryExtended2026D84Reco_cff.py | 60 + .../python/GeometryExtended2026D84_cff.py | 14 + .../Geometry/python/dict2021Geometry.py | 14 +- .../Geometry/python/dict2026Geometry.py | 244 +- Configuration/HLT/python/addOnTestsHLT.py | 8 +- Configuration/PyReleaseValidation/README.md | 14 +- .../python/MatrixReader.py | 4 +- .../PyReleaseValidation/python/relval_2017.py | 17 +- .../PyReleaseValidation/python/relval_2026.py | 3 + .../PyReleaseValidation/python/relval_gpu.py | 16 +- .../python/relval_pileup.py | 1 - .../python/relval_production.py | 1 + .../python/relval_standard.py | 1 - .../python/relval_steps.py | 67 +- .../python/upgradeWorkflowComponents.py | 68 +- .../scripts/runTheMatrix.py | 7 +- .../python/AlCaHarvesting_cff.py | 11 + .../python/AlCaRecoStreamsHeavyIons_cff.py | 24 +- .../python/AlCaRecoStreams_cff.py | 50 +- .../StandardSequences/python/Eras.py | 4 +- .../StandardSequences/python/GeometryConf.py | 3 + .../StandardSequences/python/RawToDigi_cff.py | 14 +- .../python/Reconstruction_cff.py | 17 +- DQM/CTPPS/python/ctppsDQM_cff.py | 14 +- .../test/all_ctpps_dqm_test_from_aod_cfg.py | 4 +- .../test/all_ctpps_dqm_test_from_dat_cfg.py | 4 +- .../test/all_ctpps_dqm_test_from_raw_cfg.py | 4 +- .../python/dtDigiTask_TP_cfi.py | 5 +- DQM/DTMonitorModule/python/dtDigiTask_cfi.py | 4 +- .../python/dtTriggerBaseTask_cfi.py | 6 +- .../python/slice_test_customizations_cff.py | 41 +- .../test/dt_dqm_sourceclient-live_cfg.py | 12 +- .../python/test/inputsource_live_cfi.py | 5 +- DQM/DTMonitorModule/src/DTDigiTask.cc | 28 +- .../src/DTLocalTriggerBaseTask.cc | 419 ++- .../src/DTLocalTriggerBaseTask.h | 63 +- .../clients/beam_dqm_sourceclient-live_cfg.py | 2 + .../beampixel_dqm_sourceclient-live_cfg.py | 2 + DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py | 16 +- DQM/L1TMonitor/src/L1TdeCSCTPG.cc | 4 - .../src/SiStripMonitorCluster.cc | 6 +- .../src/SiStripMonitorDigi.cc | 8 +- .../src/SiStripApvGainsDQM.cc | 2 +- .../src/SiStripBackPlaneCorrectionDQM.cc | 4 +- .../src/SiStripBaseCondObjDQM.cc | 4 +- .../src/SiStripCablingDQM.cc | 14 +- .../src/SiStripLorentzAngleDQM.cc | 4 +- .../src/SiStripPedestalsDQM.cc | 2 +- .../src/SiStripQualityDQM.cc | 18 +- .../src/SiStripMonitorTrack.cc | 2 +- DQM/TrackerRemapper/plugins/BuildFile.xml | 5 - DQM/TrackingMonitor/interface/TrackAnalyzer.h | 4 - .../interface/TrackEfficiencyClient.h | 4 - .../interface/TrackEfficiencyMonitor.h | 39 +- .../interface/TrackFoldedOccupancyClient.h | 55 + .../interface/TrackSplittingMonitor.h | 35 +- .../interface/TrackingMonitor.h | 1 - .../python/TrackFoldedOccupancyClient_cfi.py | 43 + DQM/TrackingMonitor/src/GetLumi.cc | 5 +- DQM/TrackingMonitor/src/LogMessageMonitor.cc | 3 +- .../src/PrimaryVertexResolution.cc | 23 +- DQM/TrackingMonitor/src/TrackAnalyzer.cc | 76 +- .../src/TrackBuildingAnalyzer.cc | 2 - .../src/TrackEfficiencyClient.cc | 12 - .../src/TrackEfficiencyMonitor.cc | 71 +- .../src/TrackFoldedOccupancyClient.cc | 122 + .../src/TrackSplittingMonitor.cc | 51 +- DQM/TrackingMonitor/src/TrackingMonitor.cc | 56 +- .../src/TrackingRecoMaterialAnalyser.cc | 9 +- DQM/TrackingMonitor/src/V0Monitor.cc | 15 +- DQM/TrackingMonitor/src/VertexMonitor.cc | 6 +- DQM/TrackingMonitor/src/dEdxAnalyzer.cc | 6 +- DQM/TrackingMonitor/src/dEdxHitAnalyzer.cc | 6 +- .../TrackingClientConfig_Tier0_Cosmic_cff.py | 16 +- .../python/TrackingClientConfig_Tier0_cff.py | 19 +- .../python/TrackingDQMClientHeavyIons_cfi.py | 10 +- DataFormats/CSCDigi/interface/CSCCLCTDigi.h | 27 +- .../CSCDigi/interface/CSCComparatorDigi.h | 12 +- DataFormats/CSCDigi/interface/CSCConstants.h | 133 + .../CSCDigi/interface/CSCCorrelatedLCTDigi.h | 24 +- DataFormats/CSCDigi/interface/CSCShowerDigi.h | 53 + .../interface/CSCShowerDigiCollection.h | 10 + DataFormats/CSCDigi/interface/CSCStripDigi.h | 7 +- DataFormats/CSCDigi/src/CSCCLCTDigi.cc | 22 +- DataFormats/CSCDigi/src/CSCComparatorDigi.cc | 9 + .../CSCDigi/src/CSCCorrelatedLCTDigi.cc | 23 +- DataFormats/CSCDigi/src/CSCShowerDigi.cc | 51 + DataFormats/CSCDigi/src/CSCStripDigi.cc | 5 + DataFormats/CSCDigi/src/classes.h | 2 + DataFormats/CSCDigi/src/classes_def.xml | 8 + DataFormats/ForwardDetId/interface/ETLDetId.h | 12 +- DataFormats/HGCalReco/interface/Trackster.h | 4 +- DataFormats/L1TMuon/interface/CSCConstants.h | 85 - DataFormats/L1TMuon/src/EMTFHit.cc | 2 +- .../Math/interface/choleskyInversion.h | 25 +- DataFormats/Math/test/CholeskyInvert_t.cpp | 7 + .../interface/HGCalMultiCluster.h | 2 + .../plugins/dd4hep/DDDefinitions2Objects.cc | 2 - .../CSCRawToDigi/interface/CSCAnodeData.h | 5 +- .../interface/CSCAnodeDataFormat.h | 2 + .../CSCRawToDigi/interface/CSCEventData.h | 5 +- .../interface/CSCVTMBHeaderFormat.h | 1 + .../CSCRawToDigi/plugins/CSCDCCUnpacker.cc | 8 +- EventFilter/CSCRawToDigi/src/CSCAnodeData.cc | 3 +- .../CSCRawToDigi/src/CSCAnodeData2006.cc | 3 +- .../CSCRawToDigi/src/CSCAnodeData2007.cc | 3 +- EventFilter/CSCRawToDigi/src/CSCCFEBData.cc | 23 +- .../CSCRawToDigi/src/CSCCFEBTimeSlice.cc | 8 +- .../CSCRawToDigi/src/CSCComparatorData.cc | 99 +- .../CSCRawToDigi/src/CSCDMBHeader2013.cc | 5 +- EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc | 75 +- EventFilter/CSCRawToDigi/src/CSCEventData.cc | 46 +- .../src/CSCTMBHeader2007_rev0x50c3.cc | 8 +- .../CSCRawToDigi/src/CSCTMBHeader2013.cc | 8 +- .../plugins/GEMDigiToRawModule.cc | 4 +- EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc | 2 +- .../L1TRawToDigi/src/OmtfCscUnpacker.cc | 5 +- FWCore/Framework/interface/EDLooperBase.h | 5 +- FWCore/Framework/src/EDLooperBase.cc | 35 +- FWCore/Framework/src/EventProcessor.cc | 12 + FWCore/Framework/test/BuildFile.xml | 2 +- FWCore/Framework/test/run_esproducerlooper.sh | 2 +- FWCore/Framework/test/stubs/IntTestLooper.cc | 155 + .../test/stubs/TestModuleChangeLooper.cc | 20 +- .../test/test_edlooper_consumes_cfg.py | 29 + FWCore/ParameterSet/python/Modules.py | 2 +- FWCore/ParameterSet/python/Types.py | 2 +- .../GenFilters/plugins/PythiaAllDauVFilter.cc | 202 ++ .../GenFilters/plugins/PythiaAllDauVFilter.h | 67 + .../data/dd4hep/cmsExtendedGeometry2021.xml | 6 +- ...ExtendedGeometry2021FlatMinus05Percent.xml | 6 +- ...ExtendedGeometry2021FlatMinus10Percent.xml | 6 +- ...sExtendedGeometry2021FlatPlus05Percent.xml | 6 +- ...sExtendedGeometry2021FlatPlus10Percent.xml | 6 +- .../cmsExtendedGeometry2021ZeroMaterial.xml | 6 +- .../dd4hep/cmsExtendedGeometry2026D80.xml | 1 - .../dd4hep/cmsExtendedGeometry2026D81.xml | 1 - .../dd4hep/cmsExtendedGeometry2026D82.xml | 133 + .../dd4hep/cmsExtendedGeometry2026D83.xml | 126 + .../dd4hep/cmsExtendedGeometry2026D84.xml | 126 + ...edGeometry2021FlatMinus05PercentXML_cfi.py | 6 +- ...edGeometry2021FlatMinus10PercentXML_cfi.py | 6 +- ...dedGeometry2021FlatPlus05PercentXML_cfi.py | 6 +- ...dedGeometry2021FlatPlus10PercentXML_cfi.py | 6 +- .../python/cmsExtendedGeometry2021XML_cfi.py | 6 +- ...ExtendedGeometry2021ZeroMaterialXML_cfi.py | 6 +- .../cmsExtendedGeometry2026D80XML_cfi.py | 1 - .../cmsExtendedGeometry2026D81XML_cfi.py | 1 - .../cmsExtendedGeometry2026D82XML_cfi.py | 137 + .../cmsExtendedGeometry2026D83XML_cfi.py | 130 + .../cmsExtendedGeometry2026D84XML_cfi.py | 130 + .../data/ebcon/2021/v1/ebcon.xml | 58 + .../interface/EcalBarrelNumberingScheme.h | 4 + .../dd4hep/DDEcalBarrelNewAlgoSubtraction.cc | 3054 +++++++++++++++++ .../src/EcalBarrelNumberingScheme.cc | 60 +- .../data/brm/2026/v3/brm.xml | 303 ++ .../data/hfnose/v0/hfnose.xml | 1 + .../data/hfnose/v1/hfnose.xml | 1 + .../data/hfnose/v2/hfnose.xml | 1 + .../python/hfnoseAloneXML_cfi.py | 10 +- .../python/hfnoseWaferXML_cfi.py | 4 +- .../ForwardCommonData/python/hfnoseXML_cfi.py | 7 +- .../python/testHFNoseXML_cfi.py | 3 - .../test/dumpHFNoseCell_cfg.py | 26 + .../test/dumpHFNoseWafer_cfg.py | 26 + .../test/testHFNoseParameters_cfg.py | 4 +- .../cms-test-ddhgcalWafer8-algorithm.xml | 33 + .../HGCalCommonData/plugins/DDHGCalCell.cc | 37 +- .../plugins/DDHGCalEEFileAlgo.cc | 13 +- .../plugins/DDHGCalHEFileAlgo.cc | 5 +- .../HGCalCommonData/plugins/DDHGCalWafer8.cc | 31 +- .../plugins/dd4hep/DDHGCalCell.cc | 30 +- .../plugins/dd4hep/DDHGCalHEFileAlgo.cc | 16 +- .../python/testHGCalWafer8XML_cfi.py | 9 +- Geometry/HGCalCommonData/test/cms.xml | 4 + .../test/python/runHGCalD76DD4Hep_cfg.py | 151 + .../test/python/runHGCalD76DDD_cfg.py | 150 + .../test/python/runHGCalWafer8DD4Hep_cfg.py | 133 + .../test/python/runHGCalWafer8DDD_cfg.py | 118 + .../HGCalGeometry/test/HGCalGeometryTester.cc | 12 +- .../python/testHGCalGeometryCheckV15_cfg.py | 49 + .../test/python/testHGCalGeometryCheck_cfg.py | 6 +- .../test/python/testHGCalGeometryV15_cfg.py | 53 + .../test/python/testHGCalGeometry_cfg.py | 12 +- .../python/testHGCalWaferInFileTestV15_cfg.py | 48 + .../data/mtdParameters/v2/mtdParameters.xml | 6 +- .../test/DD4hep_TestMTDIdealGeometry.cc | 2 +- .../test/TestMTDIdealGeometry.cc | 17 +- Geometry/MTDCommonData/test/testMTDinDDD.py | 2 - .../interface/MTDTopologyBuilder.h | 13 +- .../interface/RectangularMTDTopology.h | 96 +- .../MTDGeomBuilderFromGeometricTimingDet.cc | 19 +- .../src/MTDTopologyBuilder.cc | 41 +- .../src/RectangularMTDTopology.cc | 308 +- .../MTDGeometryBuilder/test/BuildFile.xml | 18 + .../test/DD4hep_TestBTLPixelTopology.cc | 331 ++ .../test/MTDDigiGeometryAnalyzer.cc | 37 +- .../MTDGeometryBuilder/test/dd4hep_mtd_cfg.py | 8 +- .../interface/MTDTopology.h | 151 +- .../plugins/MTDTopologyEP.cc | 42 +- .../src/CmsMTDStringToEnum.cc | 2 +- .../MTDNumberingBuilder/src/MTDTopology.cc | 135 +- .../MTDNumberingBuilder/test/BuildFile.xml | 27 - .../test/DD4hep_MTDTopologyAnalyzer.cc | 225 -- .../test/GeometricTimingDetAnalyzer.cc | 10 +- .../test/MTDTopologyAnalyzer.cc | 190 - .../test/dd4hep_mtd_cfg.py | 9 +- Geometry/MTDNumberingBuilder/test/mtd_cfg.py | 7 +- .../2021/v1/RP_Horizontal_Device.xml | 39 + .../2021/v1/RP_Vertical_Device.xml | 34 + .../Configuration/python/CustomConfigs.py | 5 + HLTrigger/Configuration/test/cmsDriver.csh | 8 +- .../HLTcore/interface/TriggerExpressionData.h | 8 +- .../HLTcore/src/TriggerExpressionData.cc | 6 +- .../plugins/HLTPPSPerPotTrackFilter.cc | 192 ++ .../special/plugins/HLTRechitsToDigis.cc | 7 +- .../CUDAUtilities/interface/FlexiStorage.h | 49 + .../CUDAUtilities/interface/HistoContainer.h | 195 +- .../CUDAUtilities/interface/OneToManyAssoc.h | 282 ++ .../CUDAUtilities/test/BuildFile.xml | 27 +- .../CUDAUtilities/test/FlexiStorage_t.cpp | 34 + .../CUDAUtilities/test/HistoContainerRT_t.cu | 165 + .../CUDAUtilities/test/HistoContainer_t.cpp | 31 +- .../CUDAUtilities/test/HistoContainer_t.cu | 7 +- .../CUDAUtilities/test/OneHistoContainer_t.cu | 2 +- .../CUDAUtilities/test/OneToManyAssoc_t.h | 194 +- .../src/FlatRandomPtAndDxyGunProducer.cc | 6 +- .../python/cleanJetFromEEnoise_cfi.py | 7 +- .../src/CSCSectorReceiverLUT.cc | 36 +- .../src/CSCSectorReceiverMiniLUT.cc | 26 +- .../CSCTrackFinder/src/CSCTFDTReceiver.cc | 20 +- .../CSCTrackFinder/src/CSCTFMuonSorter.cc | 6 +- L1Trigger/CSCTrackFinder/src/CSCTFPtLUT.cc | 6 +- .../CSCTrackFinder/src/CSCTFPtMethods.cc | 228 +- .../interface/CSCAnodeLCTProcessor.h | 38 +- .../interface/CSCBaseboard.h | 5 +- .../interface/CSCCathodeLCTProcessor.h | 44 +- .../interface/CSCMotherboard.h | 11 +- .../interface/CSCPatternBank.h | 2 +- .../interface/CSCTriggerPrimitivesBuilder.h | 3 + .../interface/CSCUpgradeCathodeLCTProcessor.h | 5 +- .../interface/CSCUpgradeMotherboardLUT.h | 1 - .../interface/LCTContainer.h | 2 +- .../interface/LCTQualityControl.h | 2 +- .../plugins/CSCAnodeLCTAnalyzer.cc | 11 +- .../plugins/CSCCathodeLCTAnalyzer.cc | 30 +- .../plugins/CSCCathodeLCTAnalyzer.h | 9 +- .../plugins/CSCTriggerPrimitivesProducer.cc | 15 + .../plugins/CSCTriggerPrimitivesProducer.h | 3 + .../plugins/CSCTriggerPrimitivesReader.h | 2 +- .../python/cscTriggerPrimitiveDigis_cfi.py | 5 +- .../python/params/showerParams.py | 73 + .../src/CSCAnodeLCTProcessor.cc | 97 +- .../CSCTriggerPrimitives/src/CSCBaseboard.cc | 2 + .../src/CSCCathodeLCTProcessor.cc | 112 +- .../src/CSCGEMMotherboard.cc | 9 +- .../src/CSCGEMMotherboardME11.cc | 3 +- .../src/CSCGEMMotherboardME21.cc | 3 +- .../src/CSCMotherboard.cc | 62 +- .../src/CSCMotherboardME11.cc | 3 +- .../src/CSCMuonPortCard.cc | 2 +- .../src/CSCTriggerPrimitivesBuilder.cc | 32 + .../src/CSCUpgradeAnodeLCTProcessor.cc | 2 +- .../src/CSCUpgradeCathodeLCTProcessor.cc | 18 +- .../src/CSCUpgradeMotherboard.cc | 3 +- .../src/CSCUpgradeMotherboardLUT.cc | 1 + .../src/LCTQualityControl.cc | 16 +- .../test/macros/CCLUTLinearFitWriter.cpp | 37 +- L1Trigger/L1TMuon/src/GeometryTranslator.cc | 2 +- .../L1TMuonEndCap/test/tools/MakeAngleLUT.cc | 2 +- .../L1TMuonEndCap/test/tools/MakeCoordLUT.cc | 2 +- .../L1TMuonOverlap/src/AngleConverter.cc | 2 +- .../L1TMuonOverlap/src/OMTFinputMaker.cc | 2 +- .../EcalCondDB/interface/FEConfigCokeDat.h | 147 + .../EcalCondDB/interface/FEConfigCokeInfo.h | 56 + .../EcalCondDB/interface/FEConfigMainInfo.h | 14 + .../interface/FEConfigOddWeightDat.h | 37 + .../interface/FEConfigOddWeightGroupDat.h | 59 + .../interface/FEConfigOddWeightInfo.h | 60 + .../interface/FEConfigOddWeightModeDat.h | 139 + .../interface/all_fe_config_types.h | 57 +- OnlineDB/EcalCondDB/src/FEConfigCokeDat.cc | 337 ++ OnlineDB/EcalCondDB/src/FEConfigCokeInfo.cc | 214 ++ OnlineDB/EcalCondDB/src/FEConfigMainInfo.cc | 45 +- .../EcalCondDB/src/FEConfigOddWeightDat.cc | 170 + .../src/FEConfigOddWeightGroupDat.cc | 228 ++ .../EcalCondDB/src/FEConfigOddWeightInfo.cc | 212 ++ .../src/FEConfigOddWeightModeDat.cc | 168 + OnlineDB/EcalCondDB/test/BuildFile.xml | 10 + OnlineDB/EcalCondDB/test/TestFEConfig2.cpp | 298 ++ .../EcalCondDB/test/TestOddWeightConf_v1.cpp | 329 ++ .../PatAlgos/python/patMuonMerger_cfi.py | 13 +- .../PatAlgos/python/slimming/miniAOD_tools.py | 6 +- .../python/tools/muonRecoMitigation.py | 10 +- .../runMETCorrectionsAndUncertainties.py | 41 +- .../PythonAnalysis/test/BuildFile.xml | 236 +- .../test/fwliteWithPythonConfig_cfg.py | 2 +- .../python/RecoHGCal_EventContent_cff.py | 3 + RecoHGCal/TICL/plugins/BuildFile.xml | 34 +- RecoHGCal/TICL/plugins/HGCDoublet.cc | 5 +- .../TrackstersFromSimClustersProducer.cc | 151 + RecoHGCal/TICL/plugins/TrackstersProducer.cc | 4 +- RecoHGCal/TICL/python/HADStep_cff.py | 2 +- RecoHGCal/TICL/python/SimTracksters_cff.py | 31 + RecoHGCal/TICL/python/TrkStep_cff.py | 2 +- RecoHGCal/TICL/python/iterativeTICL_cff.py | 13 +- .../JetProducers/python/caloJetsForTrk_cff.py | 9 +- RecoLocalCalo/HGCalRecProducers/BuildFile.xml | 10 - .../HGCalRecProducers/plugins/BuildFile.xml | 4 +- .../python/hfQIE10Reco_cfi.py | 16 +- .../plugins/MTDClusterProducer.cc | 11 +- .../FTLCommonAlgos/BuildFile.xml | 3 - .../FTLCommonAlgos/interface/RecHitTools.h | 35 - .../FTLCommonAlgos/plugins/BuildFile.xml | 1 + .../FTLCommonAlgos/plugins/MTDRecHitAlgo.cc | 16 +- .../FTLCommonAlgos/src/RecHitTools.cc | 31 - .../plugins/MTDRecHitProducer.cc | 5 +- .../plugins/MTDTrackingRecHitProducer.cc | 10 +- .../FTLRecProducers/test/MTDRecoDump.cc | 12 +- .../plugins/SiPixelClusterThresholds.h | 14 + .../plugins/SiPixelDigisClustersFromSoA.cc | 15 +- .../plugins/SiPixelRawToClusterCUDA.cc | 9 +- .../plugins/SiPixelRawToClusterGPUKernel.cu | 10 +- .../plugins/SiPixelRawToClusterGPUKernel.h | 4 + .../plugins/gpuClusterChargeCut.h | 13 +- .../SiPixelClusterizer/test/gpuClustering_t.h | 13 +- .../plugins/PixelRecHitGPUKernel.cu | 19 +- .../plugins/SiPixelRecHitCUDA.cc | 6 - .../plugins/SiPixelRecHitFromCUDA.cc | 2 - .../plugins/SiPixelRecHitSoAFromLegacy.cc | 2 +- .../SiPixelRecHits/plugins/gpuPixelRecHits.h | 1 - RecoMTD/DetLayers/BuildFile.xml | 1 + .../BTLDetLayerGeometryBuilder.h | 0 .../ETLDetLayerGeometryBuilder.h | 0 .../DetLayers/interface/MTDDetLayerGeometry.h | 10 +- .../plugins/MTDDetLayerGeometryESProducer.cc | 21 +- .../BTLDetLayerGeometryBuilder.cc | 2 +- .../ETLDetLayerGeometryBuilder.cc | 5 +- RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc | 19 + .../DetLayers/test/MTDRecoGeometryAnalyzer.cc | 14 +- RecoMTD/Navigation/BuildFile.xml | 11 - .../Navigation/interface/BTLNavigableLayer.h | 163 - .../interface/DirectMTDNavigation.h | 57 - .../Navigation/interface/ETLNavigableLayer.h | 113 - RecoMTD/Navigation/interface/MTDDetLayerMap.h | 41 - RecoMTD/Navigation/interface/MTDEtaRange.h | 41 - .../Navigation/interface/MTDNavigableLayer.h | 49 - .../interface/MTDNavigationPrinter.h | 40 - .../interface/MTDNavigationSchool.h | 74 - RecoMTD/Navigation/src/BTLNavigableLayer.cc | 147 - RecoMTD/Navigation/src/DirectMTDNavigation.cc | 254 -- RecoMTD/Navigation/src/ETLNavigableLayer.cc | 151 - RecoMTD/Navigation/src/MTDEtaRange.cc | 76 - RecoMTD/Navigation/src/MTDNavigableLayer.cc | 78 - .../Navigation/src/MTDNavigationPrinter.cc | 176 - RecoMTD/Navigation/src/MTDNavigationSchool.cc | 334 -- RecoMTD/Navigation/test/BuildFile.xml | 7 - RecoMTD/Navigation/test/MTDNavigationTest.cc | 79 - .../plugins/TrackExtenderWithMTD.cc | 35 +- RecoPPS/Configuration/python/recoCTPPS_cff.py | 5 - RecoPPS/Configuration/test/raw_data_test.py | 4 +- .../plugins/CTPPSLocalTrackLiteProducer.cc | 2 +- .../python/ctppsLocalTrackLiteProducer_cff.py | 4 +- .../python/ctppsProtons_cff.py | 4 +- .../interface/PFClusterEMEnergyCorrector.h | 1 + .../plugins/PFBadHcalPseudoClusterProducer.cc | 2 +- .../particleFlowBadHcalPseudoCluster_cff.py | 7 +- .../src/PFClusterEMEnergyCorrector.cc | 6 +- .../PFProducer/python/particleFlow_cff.py | 8 +- .../PFProducer/src/PFEGammaFilters.cc | 4 +- .../interface/LightPFTrackProducer.h | 4 + .../PFTracking/interface/PFNuclearProducer.h | 4 + .../PFTracking/interface/PFTrackProducer.h | 7 + .../PFTracking/plugins/GoodSeedProducer.cc | 34 +- .../plugins/HGCalTrackCollectionProducer.cc | 41 +- .../plugins/LightPFTrackProducer.cc | 8 +- .../plugins/PFConversionProducer.cc | 17 +- .../PFTracking/plugins/PFConversionProducer.h | 7 + .../PFDisplacedTrackerVertexProducer.cc | 8 +- .../PFDisplacedTrackerVertexProducer.h | 4 + .../PFDisplacedVertexCandidateProducer.cc | 13 +- .../PFDisplacedVertexCandidateProducer.h | 6 +- .../plugins/PFDisplacedVertexProducer.cc | 37 +- .../plugins/PFDisplacedVertexProducer.h | 13 +- .../PFTracking/plugins/PFElecTkProducer.cc | 22 +- .../PFTracking/plugins/PFNuclearProducer.cc | 9 +- .../PFTracking/plugins/PFTrackProducer.cc | 19 +- .../PFTracking/plugins/PFV0Producer.cc | 8 +- .../PFTracking/plugins/PFV0Producer.h | 4 + .../plugins/BrokenLineFitOnGPU.h | 4 +- .../PixelTriplets/plugins/CAConstants.h | 3 +- .../plugins/CAHitNtupletGeneratorKernels.cc | 14 +- .../plugins/CAHitNtupletGeneratorKernels.cu | 45 +- .../plugins/CAHitNtupletGeneratorKernels.h | 14 +- .../CAHitNtupletGeneratorKernelsAlloc.h | 21 +- .../CAHitNtupletGeneratorKernelsImpl.h | 69 +- .../plugins/CAHitNtupletGeneratorOnGPU.cc | 23 +- .../PixelTriplets/plugins/RiemannFitOnGPU.h | 2 +- .../TrackerMTDRecoGeometryESProducer.cc | 70 + .../TrackerMTDRecoGeometryESProducer_cfi.py | 8 + .../MkFit/plugins/MkFitOutputConverter.cc | 3 +- .../interface/TrackerRecoGeometryRecord.h | 13 +- RecoTracker/TkDetLayers/BuildFile.xml | 1 + .../interface/GeometricSearchTracker.h | 16 + .../interface/GeometricSearchTrackerBuilder.h | 9 + .../TkDetLayers/src/GeometricSearchTracker.cc | 135 +- .../src/GeometricSearchTrackerBuilder.cc | 249 +- .../plugins/SimpleBarrelNavigableLayer.cc | 41 +- .../plugins/SimpleNavigationSchool.cc | 5 +- .../test/NavigationSchoolAnalyzer.cc | 9 + .../test/NavigationSchoolAnalyzer_cfg.py | 10 +- .../TkSeedGenerator/plugins/BuildFile.xml | 1 - .../interface/DAClusterizerInZ_vect.h | 3 +- .../src/DAClusterizerInZ_vect.cc | 73 +- .../EcalEBTrigPrimAlgos/BuildFile.xml | 2 - ...eFilter.h => EcalEBFenixAmplitudeFilter.h} | 12 +- ...ixLinearizer.h => EcalEBFenixLinearizer.h} | 24 +- ...ixPeakFinder.h => EcalEBFenixPeakFinder.h} | 12 +- ...pFormatEB.h => EcalEBFenixStripFormatEB.h} | 12 +- ...enixTcpFormat.h => EcalEBFenixTcpFormat.h} | 12 +- .../interface/EcalEBTrigPrimTestAlgo.h | 65 +- ...ilter.cc => EcalEBFenixAmplitudeFilter.cc} | 30 +- ...Linearizer.cc => EcalEBFenixLinearizer.cc} | 28 +- ...PeakFinder.cc => EcalEBFenixPeakFinder.cc} | 18 +- ...ormatEB.cc => EcalEBFenixStripFormatEB.cc} | 28 +- ...ixTcpFormat.cc => EcalEBFenixTcpFormat.cc} | 36 +- .../src/EcalEBTrigPrimTestAlgo.cc | 52 +- .../plugins/EcalEBTrigPrimProducer.cc | 16 +- .../plugins/EcalEBTrigPrimProducer.h | 6 + .../interface/EcalFenixAmplitudeFilter.h | 7 +- .../interface/EcalFenixBypassLin.h | 4 +- .../interface/EcalFenixEtStrip.h | 4 +- .../interface/EcalFenixEtTot.h | 16 +- .../interface/EcalFenixFgvbEB.h | 4 +- .../interface/EcalFenixLinearizer.h | 4 +- .../interface/EcalFenixMaxof2.h | 8 +- .../interface/EcalFenixOddAmplitudeFilter.h | 45 + .../interface/EcalFenixPeakFinder.h | 4 +- .../interface/EcalFenixStrip.h | 210 +- .../interface/EcalFenixStripFgvbEE.h | 4 +- .../interface/EcalFenixStripFormatEB.h | 23 +- .../interface/EcalFenixStripFormatEE.h | 23 +- .../interface/EcalFenixTcp.h | 31 +- .../interface/EcalFenixTcpFgvbEE.h | 4 +- .../interface/EcalFenixTcpFormatEB.h | 58 + ...enixTcpFormat.h => EcalFenixTcpFormatEE.h} | 22 +- .../interface/EcalTrigPrimFunctionalAlgo.h | 43 +- .../src/EcalFenixAmplitudeFilter.cc | 38 +- .../EcalTrigPrimAlgos/src/EcalFenixEtTot.cc | 22 +- .../EcalTrigPrimAlgos/src/EcalFenixMaxof2.cc | 23 +- .../src/EcalFenixOddAmplitudeFilter.cc | 109 + .../EcalTrigPrimAlgos/src/EcalFenixStrip.cc | 248 +- .../src/EcalFenixStripFormatEB.cc | 90 +- .../src/EcalFenixStripFormatEE.cc | 90 +- .../EcalTrigPrimAlgos/src/EcalFenixTcp.cc | 101 +- ...ixTcpFormat.cc => EcalFenixTcpFormatEB.cc} | 87 +- .../src/EcalFenixTcpFormatEE.cc | 158 + .../src/EcalTrigPrimFunctionalAlgo.cc | 23 +- .../plugins/EcalTPCondAnalyzer.cc | 486 +-- .../plugins/EcalTPCondAnalyzer.h | 49 +- .../plugins/EcalTrigPrimProducer.cc | 48 +- .../python/ecalTrigPrimESDoubleWeights_cff.py | 15 + .../python/ecalTriggerPrimitiveDigis_cff.py | 3 + .../test/readDBTPConds_GlobalTag_cfg.py | 23 +- .../test/readDBTPConds_beamv5_ideal_cfg.py | 17 + .../test/readDBTPConds_beamv5_startup_cfg.py | 17 + .../test/readDBTPConds_cfg.py | 18 +- .../interface/AssociatorTools.h | 9 +- ...LayerClusterAssociatorByEnergyScoreImpl.cc | 2 +- .../plugins/MCToCPAssociatorEDProducer.cc | 94 + ...MultiClusterAssociatorByEnergyScoreImpl.cc | 529 +++ .../MultiClusterAssociatorByEnergyScoreImpl.h | 70 + ...iClusterAssociatorByEnergyScoreProducer.cc | 67 + .../TracksterAssociatorByEnergyScoreImpl.cc | 533 +++ .../TracksterAssociatorByEnergyScoreImpl.h | 64 + ...racksterAssociatorByEnergyScoreProducer.cc | 67 + .../python/MCToCPAssociation_cfi.py | 12 + .../python/TSToSCAssociation_cfi.py | 13 + SimDataFormats/Associations/BuildFile.xml | 1 + .../LayerClusterToSimClusterAssociator.h | 10 +- .../MultiClusterToCaloParticleAssociator.h | 50 + ...iClusterToCaloParticleAssociatorBaseImpl.h | 47 + .../TracksterToSimClusterAssociator.h | 49 + .../TracksterToSimClusterAssociatorBaseImpl.h | 49 + .../Associations/plugins/BuildFile.xml | 1 + .../plugins/TSToSCAssociatorEDProducer.cc | 95 + .../MultiClusterToCaloParticleAssociator.cc | 7 + ...ClusterToCaloParticleAssociatorBaseImpl.cc | 21 + .../src/TracksterToSimClusterAssociator.cc | 7 + ...TracksterToSimClusterAssociatorBaseImpl.cc | 23 + SimDataFormats/Associations/src/classes.h | 6 + .../Associations/src/classes_def.xml | 38 +- .../FastTimingCommon/interface/BTLDeviceSim.h | 4 +- .../interface/BTLElectronicsSim.h | 2 +- .../FastTimingCommon/interface/ETLDeviceSim.h | 3 +- .../interface/ETLElectronicsSim.h | 3 +- .../FastTimingCommon/interface/MTDDigitizer.h | 31 +- .../interface/MTDDigitizerBase.h | 6 - .../plugins/MTDDigiProducer.cc | 14 - .../plugins/MTDDigiProducer.h | 9 +- .../plugins/PreMixingMTDWorker.cc | 10 +- .../FastTimingCommon/src/BTLDeviceSim.cc | 20 +- .../FastTimingCommon/src/BTLElectronicsSim.cc | 3 +- .../FastTimingCommon/src/ETLDeviceSim.cc | 23 +- .../FastTimingCommon/src/ETLElectronicsSim.cc | 12 +- .../FastTimingCommon/test/MTDDigiDump.cc | 12 +- .../interface/LowEnergyFastSimModel.h | 7 +- .../Application/interface/RunManagerMT.h | 1 - SimG4Core/Application/python/g4SimHits_cfi.py | 14 +- .../Application/src/LowEnergyFastSimModel.cc | 17 +- .../Application/src/ParametrisedEMPhysics.cc | 30 +- SimG4Core/Application/src/RunManagerMT.cc | 4 +- ...g.py => dd4hep_ttbar_2026D77_Step1_cfg.py} | 9 +- .../data/particle_darkphoton.txt | 3 +- .../interface/CMSDarkPairProductionProcess.h | 3 - .../interface/CMSSIMPInelasticProcess.h | 3 +- .../interface/CMSSIMPInelasticXS.h | 6 +- .../interface/DummyChargeFlipProcess.h | 17 +- .../CustomPhysics/interface/G4ProcessHelper.h | 2 +- .../src/CMSDarkPairProductionProcess.cc | 9 +- .../src/CMSSIMPInelasticProcess.cc | 1 - .../CustomPhysics/src/CustomPDGParser.cc | 8 +- SimG4Core/CustomPhysics/src/CustomPhysics.cc | 8 +- .../CustomPhysics/src/CustomPhysicsList.cc | 2 +- .../src/DummyChargeFlipProcess.cc | 57 +- .../src/FullModelHadronicProcess.cc | 9 +- .../src/FullModelReactionDynamics.cc | 14 +- SimG4Core/GFlash/plugins/GFlash.cc | 8 +- SimG4Core/Generators/src/Generator.cc | 9 +- SimG4Core/PhysicsLists/doc/PhysicsLists.doc | 39 +- .../interface/CMSEmStandardPhysics.h | 17 +- .../interface/CMSEmStandardPhysics95.h | 21 - .../interface/CMSEmStandardPhysics95msc93.h | 21 - .../interface/CMSEmStandardPhysicsLPM.h | 8 + .../interface/CMSEmStandardPhysicsXS.h | 17 +- .../interface/CMSFTFPNeutronBuilder.hh | 49 - .../interface/CMSFTFPPiKBuilder.hh | 55 - .../interface/CMSFTFPProtonBuilder.hh | 47 - .../interface/CMSHadronPhysicsFTFP_BERT.h | 33 +- .../interface/CMSHadronPhysicsFTFP_BERT106.h | 45 + .../HadronPhysicsQGSPCMS_FTFP_BERT.h | 32 +- .../PhysicsLists/interface/UrbanMscModel93.h | 232 -- .../PhysicsLists/plugins/DummyPhysics.cc | 2 +- .../PhysicsLists/plugins/FTFPCMS_BERT_EML.cc | 4 +- .../PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc | 4 +- .../plugins/FTFPCMS_BERT_EMM_TRK.cc | 4 +- .../PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc | 2 +- .../plugins/FTFPCMS_BERT_HP_EML.cc | 12 +- .../plugins/FTFPCMS_BERT_HP_EMM.cc | 4 +- .../plugins/FTFPCMS_BERT_XS_EML.cc | 12 +- .../plugins/FTFPCMS_INCLXX_EMM.cc | 4 +- .../plugins/FTFPCMS_INCLXX_HP_EMM.cc | 4 +- SimG4Core/PhysicsLists/plugins/QBBCCMS.cc | 4 +- .../PhysicsLists/plugins/QGSPCMS_BERT_EML.cc | 4 +- .../plugins/QGSPCMS_BERT_HP_EML.cc | 4 +- .../plugins/QGSPCMS_FTFP_BERT_EML.cc | 4 +- .../plugins/QGSPCMS_FTFP_BERT_EMM.cc | 4 +- .../plugins/QGSPCMS_FTFP_BERT_EMN.cc | 2 +- .../PhysicsLists/src/CMSEmStandardPhysics.cc | 420 +-- .../src/CMSEmStandardPhysics95.cc | 254 -- .../src/CMSEmStandardPhysics95msc93.cc | 261 -- .../src/CMSEmStandardPhysicsXS.cc | 554 ++- .../PhysicsLists/src/CMSFTFPNeutronBuilder.cc | 55 - .../PhysicsLists/src/CMSFTFPPiKBuilder.cc | 81 - .../PhysicsLists/src/CMSFTFPProtonBuilder.cc | 50 - .../src/CMSHadronPhysicsFTFP_BERT.cc | 182 +- .../src/CMSHadronPhysicsFTFP_BERT106.cc | 192 ++ .../src/HadronPhysicsQGSPCMS_FTFP_BERT.cc | 206 +- SimG4Core/PhysicsLists/src/UrbanMscModel93.cc | 1020 ------ .../interface/PrintGeomInfoAction.h | 1 + .../PrintGeomInfo/src/PrintGeomInfoAction.cc | 41 +- .../PrintGeomInfo/test/SimFileCompare.cpp | 288 +- .../test/python/runDD4HEP_cfg.py | 2 + .../PrintGeomInfo/test/python/runDDD_cfg.py | 5 +- SimG4Core/Watcher/interface/SimWatcher.h | 20 +- .../test/gluglu_step1_GEN_SIM_2021.py | 38 +- .../test/gluglu_step2_DIGI_DIGI2RAW_2021.py | 12 +- .../gluglu_step3_RAW2DIGI_L1Reco_RECO_2021.py | 35 +- .../test/pg_step1_GEN_SIM_2021.py | 32 +- .../test/pg_step2_DIGI_DIGI2RAW_2021.py | 10 +- .../test/pg_step3_MCDB_RAW2DIGI_RECO_2021.py | 37 +- .../plugins/Pixel3DDigitizerAlgorithm.cc | 68 +- .../python/PixelTestBeamValidation_cfi.py | 10 + .../test/PixelTestBeamValidation.cc | 35 +- .../test/PixelTestBeamValidation.h | 5 +- .../python/OpticalFunctionsConfig_cfi.py | 35 +- .../python/PPSTransportESSources_cfi.py | 28 +- .../python/PPSTransport_cff.py | 4 +- .../SimTransportTotemRPProtTranspParLinkDef.h | 17 - .../src/classes.h | 3 + .../src/classes_def.xml | 7 + .../src/GlobalDetLayerGeometry.cc | 3 +- .../CTPPS/python/simu_config/year_2021_cff.py | 5 +- .../python/globalValidation_cff.py | 2 +- .../Configuration/python/hgcalSimValid_cff.py | 6 + .../interface/MaterialBudgetHcalHistos.h | 6 +- .../Geometry/{test => macros}/CMS_lumi.C | 0 .../ECALMaterialBudgetCompare.C | 0 .../Geometry/{test => macros}/MatBudgetHcal.C | 173 +- .../{test => macros}/MaterialBudgetCalo.C | 0 .../{test => macros}/MaterialBudgetMtd.C | 0 .../{test => macros}/MaterialBudget_Maps.C | 0 .../{test => macros}/MaterialBudget_TDR.C | 0 .../TrackerNumberingComparison.C | 0 .../Geometry/{test => macros}/tdrStyle.C | 0 Validation/Geometry/src/MaterialBudget.cc | 25 +- .../Geometry/src/MaterialBudgetAction.cc | 40 +- Validation/Geometry/src/MaterialBudgetData.cc | 26 +- .../Geometry/src/MaterialBudgetEcalHistos.cc | 6 +- .../Geometry/src/MaterialBudgetHcalHistos.cc | 64 +- Validation/Geometry/test/runP_ECAL_cfg.py | 30 +- .../Geometry/test/runP_ECAL_dd4hep_cfg.py | 59 + Validation/Geometry/test/runP_HCAL_cfg.py | 1 + .../Geometry/test/runP_HCAL_dd4hep_cfg.py | 64 + .../interface/HGCalValidator.h | 7 +- .../interface/HGVHistoProducerAlgo.h | 1 + .../HGCalValidation/plugins/BuildFile.xml | 3 - .../HGCalValidation/plugins/HGCalValidator.cc | 24 +- .../plugins/TICLTrackstersEdgesValidation.cc | 329 ++ .../CaloParticleSelectionForEfficiency_cfi.py | 2 +- .../python/HGCalValidator_cfi.py | 27 +- .../python/PostProcessorHGCAL_cfi.py | 18 +- .../HGCalValidation/python/hgcalPlots.py | 124 +- .../ticlTrackstersEdgesValidation_cfi.py | 4 + .../scripts/makeHGCalValidationPlots.py | 32 +- .../src/HGVHistoProducerAlgo.cc | 14 +- .../python/standalone_onlyTICL_HARVESTING.py | 98 + .../python/standalone_onlyTICL_fromRECO.py | 154 + .../plugins/BtlDigiHitsValidation.cc | 11 +- .../plugins/BtlLocalRecoValidation.cc | 11 +- .../plugins/BtlSimHitsValidation.cc | 11 +- .../plugins/EtlDigiHitsValidation.cc | 15 +- .../plugins/EtlLocalRecoValidation.cc | 15 +- .../plugins/EtlSimHitsValidation.cc | 11 +- .../plugins/MtdTracksValidation.cc | 6 +- .../MuonCSCDigis/src/CSCALCTDigiValidation.cc | 7 +- .../MuonCSCDigis/src/CSCCLCTDigiValidation.cc | 7 +- Validation/MuonCSCDigis/src/CSCStubMatcher.cc | 6 +- .../RecoTrack/python/plotting/plotting.py | 5 +- 724 files changed, 24867 insertions(+), 11169 deletions(-) create mode 100644 CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h create mode 100644 CalibPPS/TimingCalibration/plugins/BuildFile.xml create mode 100644 CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc create mode 100644 CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLWorker.cc create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_Output_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_cff.py create mode 100644 CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersAnalyzer.cc create mode 100644 Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersProducer.cc create mode 100644 Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_Output_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/NearbyPixelClustersProducer_cfi.py create mode 100644 Calibration/TkAlCaRecoProducers/python/TrackDistanceValueMapProducer_cfi.py create mode 100644 Calibration/TkAlCaRecoProducers/test/inspectNearByPixelClusters_cfg.py create mode 100644 CondTools/Ecal/interface/EcalTPGOddWeightGroupHandler.h create mode 100644 CondTools/Ecal/interface/EcalTPGOddWeightIdMapHandler.h create mode 100644 CondTools/Ecal/interface/EcalTPGTPModeHandler.h create mode 100644 CondTools/Ecal/python/copyTPMode_cfg.py create mode 100644 CondTools/Ecal/python/copyWOddGroup_cfg.py create mode 100644 CondTools/Ecal/python/copyWOddIdMap_cfg.py create mode 100644 CondTools/Ecal/src/EcalTPGOddWeightGroupHandler.cc create mode 100644 CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc create mode 100644 CondTools/Ecal/src/EcalTPGTPModeHandler.cc rename Configuration/Eras/python/{Modifier_pf_badHcalMitigation_cff.py => Modifier_ctpps_cff.py} (51%) create mode 100644 Configuration/Eras/python/Modifier_pf_badHcalMitigationOff_cff.py create mode 100644 Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py create mode 100644 Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py create mode 100644 Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py create mode 100644 Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py create mode 100644 Configuration/Geometry/python/GeometryDD4hepExtended2026D82Reco_cff.py create mode 100644 Configuration/Geometry/python/GeometryDD4hepExtended2026D82_cff.py create mode 100644 Configuration/Geometry/python/GeometryDD4hepExtended2026D83Reco_cff.py create mode 100644 Configuration/Geometry/python/GeometryDD4hepExtended2026D83_cff.py create mode 100644 Configuration/Geometry/python/GeometryDD4hepExtended2026D84Reco_cff.py create mode 100644 Configuration/Geometry/python/GeometryDD4hepExtended2026D84_cff.py create mode 100644 Configuration/Geometry/python/GeometryExtended2026D82Reco_cff.py create mode 100644 Configuration/Geometry/python/GeometryExtended2026D82_cff.py create mode 100644 Configuration/Geometry/python/GeometryExtended2026D83Reco_cff.py create mode 100644 Configuration/Geometry/python/GeometryExtended2026D83_cff.py create mode 100644 Configuration/Geometry/python/GeometryExtended2026D84Reco_cff.py create mode 100644 Configuration/Geometry/python/GeometryExtended2026D84_cff.py create mode 100644 DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h create mode 100644 DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py create mode 100644 DQM/TrackingMonitor/src/TrackFoldedOccupancyClient.cc create mode 100644 DataFormats/CSCDigi/interface/CSCConstants.h create mode 100644 DataFormats/CSCDigi/interface/CSCShowerDigi.h create mode 100644 DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h create mode 100644 DataFormats/CSCDigi/src/CSCShowerDigi.cc delete mode 100644 DataFormats/L1TMuon/interface/CSCConstants.h create mode 100644 FWCore/Framework/test/stubs/IntTestLooper.cc create mode 100644 FWCore/Framework/test/test_edlooper_consumes_cfg.py create mode 100644 GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.cc create mode 100644 GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.h create mode 100644 Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D82.xml create mode 100644 Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D83.xml create mode 100644 Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D84.xml create mode 100644 Geometry/CMSCommonData/python/cmsExtendedGeometry2026D82XML_cfi.py create mode 100644 Geometry/CMSCommonData/python/cmsExtendedGeometry2026D83XML_cfi.py create mode 100644 Geometry/CMSCommonData/python/cmsExtendedGeometry2026D84XML_cfi.py create mode 100644 Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml create mode 100644 Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgoSubtraction.cc create mode 100644 Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml create mode 100644 Geometry/ForwardCommonData/test/dumpHFNoseCell_cfg.py create mode 100644 Geometry/ForwardCommonData/test/dumpHFNoseWafer_cfg.py create mode 100644 Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalWafer8-algorithm.xml create mode 100644 Geometry/HGCalCommonData/test/python/runHGCalD76DD4Hep_cfg.py create mode 100644 Geometry/HGCalCommonData/test/python/runHGCalD76DDD_cfg.py create mode 100644 Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4Hep_cfg.py create mode 100644 Geometry/HGCalCommonData/test/python/runHGCalWafer8DDD_cfg.py create mode 100644 Geometry/HGCalGeometry/test/python/testHGCalGeometryCheckV15_cfg.py create mode 100644 Geometry/HGCalGeometry/test/python/testHGCalGeometryV15_cfg.py create mode 100644 Geometry/HGCalGeometry/test/python/testHGCalWaferInFileTestV15_cfg.py create mode 100644 Geometry/MTDGeometryBuilder/test/DD4hep_TestBTLPixelTopology.cc delete mode 100644 Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc delete mode 100644 Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc create mode 100644 Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml create mode 100644 Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml create mode 100644 HLTrigger/special/plugins/HLTPPSPerPotTrackFilter.cc create mode 100644 HeterogeneousCore/CUDAUtilities/interface/FlexiStorage.h create mode 100644 HeterogeneousCore/CUDAUtilities/interface/OneToManyAssoc.h create mode 100644 HeterogeneousCore/CUDAUtilities/test/FlexiStorage_t.cpp create mode 100644 HeterogeneousCore/CUDAUtilities/test/HistoContainerRT_t.cu create mode 100644 L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py create mode 100644 OnlineDB/EcalCondDB/interface/FEConfigCokeDat.h create mode 100644 OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h create mode 100644 OnlineDB/EcalCondDB/interface/FEConfigOddWeightDat.h create mode 100644 OnlineDB/EcalCondDB/interface/FEConfigOddWeightGroupDat.h create mode 100644 OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h create mode 100644 OnlineDB/EcalCondDB/interface/FEConfigOddWeightModeDat.h create mode 100644 OnlineDB/EcalCondDB/src/FEConfigCokeDat.cc create mode 100644 OnlineDB/EcalCondDB/src/FEConfigCokeInfo.cc create mode 100644 OnlineDB/EcalCondDB/src/FEConfigOddWeightDat.cc create mode 100644 OnlineDB/EcalCondDB/src/FEConfigOddWeightGroupDat.cc create mode 100644 OnlineDB/EcalCondDB/src/FEConfigOddWeightInfo.cc create mode 100644 OnlineDB/EcalCondDB/src/FEConfigOddWeightModeDat.cc create mode 100644 OnlineDB/EcalCondDB/test/TestFEConfig2.cpp create mode 100644 OnlineDB/EcalCondDB/test/TestOddWeightConf_v1.cpp create mode 100644 RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc create mode 100644 RecoHGCal/TICL/python/SimTracksters_cff.py delete mode 100644 RecoLocalFastTime/FTLCommonAlgos/interface/RecHitTools.h delete mode 100644 RecoLocalFastTime/FTLCommonAlgos/src/RecHitTools.cc create mode 100644 RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterThresholds.h rename RecoMTD/DetLayers/{plugins => interface}/BTLDetLayerGeometryBuilder.h (100%) rename RecoMTD/DetLayers/{plugins => interface}/ETLDetLayerGeometryBuilder.h (100%) rename RecoMTD/DetLayers/{plugins => src}/BTLDetLayerGeometryBuilder.cc (97%) rename RecoMTD/DetLayers/{plugins => src}/ETLDetLayerGeometryBuilder.cc (98%) delete mode 100644 RecoMTD/Navigation/BuildFile.xml delete mode 100644 RecoMTD/Navigation/interface/BTLNavigableLayer.h delete mode 100644 RecoMTD/Navigation/interface/DirectMTDNavigation.h delete mode 100644 RecoMTD/Navigation/interface/ETLNavigableLayer.h delete mode 100644 RecoMTD/Navigation/interface/MTDDetLayerMap.h delete mode 100644 RecoMTD/Navigation/interface/MTDEtaRange.h delete mode 100644 RecoMTD/Navigation/interface/MTDNavigableLayer.h delete mode 100644 RecoMTD/Navigation/interface/MTDNavigationPrinter.h delete mode 100644 RecoMTD/Navigation/interface/MTDNavigationSchool.h delete mode 100644 RecoMTD/Navigation/src/BTLNavigableLayer.cc delete mode 100644 RecoMTD/Navigation/src/DirectMTDNavigation.cc delete mode 100644 RecoMTD/Navigation/src/ETLNavigableLayer.cc delete mode 100644 RecoMTD/Navigation/src/MTDEtaRange.cc delete mode 100644 RecoMTD/Navigation/src/MTDNavigableLayer.cc delete mode 100644 RecoMTD/Navigation/src/MTDNavigationPrinter.cc delete mode 100644 RecoMTD/Navigation/src/MTDNavigationSchool.cc delete mode 100644 RecoMTD/Navigation/test/BuildFile.xml delete mode 100644 RecoMTD/Navigation/test/MTDNavigationTest.cc create mode 100644 RecoTracker/GeometryESProducer/plugins/TrackerMTDRecoGeometryESProducer.cc create mode 100644 RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py rename SimCalorimetry/EcalEBTrigPrimAlgos/interface/{EcalFenixAmplitudeFilter.h => EcalEBFenixAmplitudeFilter.h} (73%) rename SimCalorimetry/EcalEBTrigPrimAlgos/interface/{EcalFenixLinearizer.h => EcalEBFenixLinearizer.h} (69%) rename SimCalorimetry/EcalEBTrigPrimAlgos/interface/{EcalFenixPeakFinder.h => EcalEBFenixPeakFinder.h} (72%) rename SimCalorimetry/EcalEBTrigPrimAlgos/interface/{EcalFenixStripFormatEB.h => EcalEBFenixStripFormatEB.h} (70%) rename SimCalorimetry/EcalEBTrigPrimAlgos/interface/{EcalFenixTcpFormat.h => EcalEBFenixTcpFormat.h} (80%) rename SimCalorimetry/EcalEBTrigPrimAlgos/src/{EcalFenixAmplitudeFilter.cc => EcalEBFenixAmplitudeFilter.cc} (72%) rename SimCalorimetry/EcalEBTrigPrimAlgos/src/{EcalFenixLinearizer.cc => EcalEBFenixLinearizer.cc} (74%) rename SimCalorimetry/EcalEBTrigPrimAlgos/src/{EcalFenixPeakFinder.cc => EcalEBFenixPeakFinder.cc} (59%) rename SimCalorimetry/EcalEBTrigPrimAlgos/src/{EcalFenixStripFormatEB.cc => EcalEBFenixStripFormatEB.cc} (50%) rename SimCalorimetry/EcalEBTrigPrimAlgos/src/{EcalFenixTcpFormat.cc => EcalEBFenixTcpFormat.cc} (76%) create mode 100644 SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixOddAmplitudeFilter.h create mode 100644 SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEB.h rename SimCalorimetry/EcalTrigPrimAlgos/interface/{EcalFenixTcpFormat.h => EcalFenixTcpFormatEE.h} (66%) create mode 100644 SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixOddAmplitudeFilter.cc rename SimCalorimetry/EcalTrigPrimAlgos/src/{EcalFenixTcpFormat.cc => EcalFenixTcpFormatEB.cc} (55%) create mode 100644 SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEE.cc create mode 100644 SimCalorimetry/EcalTrigPrimProducers/python/ecalTrigPrimESDoubleWeights_cff.py create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.cc create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.h create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreProducer.cc create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h create mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc create mode 100644 SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py create mode 100644 SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py create mode 100644 SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h create mode 100644 SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociatorBaseImpl.h create mode 100644 SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h create mode 100644 SimDataFormats/Associations/interface/TracksterToSimClusterAssociatorBaseImpl.h create mode 100644 SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc create mode 100644 SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociator.cc create mode 100644 SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociatorBaseImpl.cc create mode 100644 SimDataFormats/Associations/src/TracksterToSimClusterAssociator.cc create mode 100644 SimDataFormats/Associations/src/TracksterToSimClusterAssociatorBaseImpl.cc rename SimG4Core/Configuration/test/{dd4hep_ttbar_2026D49_Step1_cfg.py => dd4hep_ttbar_2026D77_Step1_cfg.py} (97%) delete mode 100644 SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95.h delete mode 100644 SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95msc93.h delete mode 100644 SimG4Core/PhysicsLists/interface/CMSFTFPNeutronBuilder.hh delete mode 100644 SimG4Core/PhysicsLists/interface/CMSFTFPPiKBuilder.hh delete mode 100644 SimG4Core/PhysicsLists/interface/CMSFTFPProtonBuilder.hh create mode 100644 SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h delete mode 100644 SimG4Core/PhysicsLists/interface/UrbanMscModel93.h delete mode 100644 SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95.cc delete mode 100644 SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95msc93.cc delete mode 100644 SimG4Core/PhysicsLists/src/CMSFTFPNeutronBuilder.cc delete mode 100644 SimG4Core/PhysicsLists/src/CMSFTFPPiKBuilder.cc delete mode 100644 SimG4Core/PhysicsLists/src/CMSFTFPProtonBuilder.cc create mode 100644 SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT106.cc delete mode 100644 SimG4Core/PhysicsLists/src/UrbanMscModel93.cc delete mode 100644 SimTransport/TotemRPProtonTransportParametrization/src/SimTransportTotemRPProtTranspParLinkDef.h create mode 100644 SimTransport/TotemRPProtonTransportParametrization/src/classes.h create mode 100644 SimTransport/TotemRPProtonTransportParametrization/src/classes_def.xml rename Validation/Geometry/{test => macros}/CMS_lumi.C (100%) rename Validation/Geometry/{test => macros}/ECALMaterialBudgetCompare.C (100%) rename Validation/Geometry/{test => macros}/MatBudgetHcal.C (92%) rename Validation/Geometry/{test => macros}/MaterialBudgetCalo.C (100%) rename Validation/Geometry/{test => macros}/MaterialBudgetMtd.C (100%) rename Validation/Geometry/{test => macros}/MaterialBudget_Maps.C (100%) rename Validation/Geometry/{test => macros}/MaterialBudget_TDR.C (100%) rename Validation/Geometry/{test => macros}/TrackerNumberingComparison.C (100%) rename Validation/Geometry/{test => macros}/tdrStyle.C (100%) create mode 100644 Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py create mode 100644 Validation/Geometry/test/runP_HCAL_dd4hep_cfg.py create mode 100644 Validation/HGCalValidation/plugins/TICLTrackstersEdgesValidation.cc create mode 100644 Validation/HGCalValidation/python/ticlTrackstersEdgesValidation_cfi.py create mode 100644 Validation/HGCalValidation/test/python/standalone_onlyTICL_HARVESTING.py create mode 100644 Validation/HGCalValidation/test/python/standalone_onlyTICL_fromRECO.py diff --git a/Alignment/LaserAlignmentSimulation/plugins/BuildFile.xml b/Alignment/LaserAlignmentSimulation/plugins/BuildFile.xml index 254ed3d401bd2..ebc3ff59a0f6d 100644 --- a/Alignment/LaserAlignmentSimulation/plugins/BuildFile.xml +++ b/Alignment/LaserAlignmentSimulation/plugins/BuildFile.xml @@ -19,7 +19,6 @@ - diff --git a/Alignment/LaserAlignmentSimulation/plugins/LaserOpticalPhysics.cc b/Alignment/LaserAlignmentSimulation/plugins/LaserOpticalPhysics.cc index 468b572c4609e..84a5ca5f26781 100644 --- a/Alignment/LaserAlignmentSimulation/plugins/LaserOpticalPhysics.cc +++ b/Alignment/LaserAlignmentSimulation/plugins/LaserOpticalPhysics.cc @@ -13,8 +13,8 @@ #include "G4HadronPhysicsQGSP_FTFP_BERT.hh" #include "SimG4Core/Physics/interface/PhysicsListFactory.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" +#include "G4EmStandardPhysics_option1.hh" #include "G4DecayPhysics.hh" #include "G4EmExtraPhysics.hh" #include "G4HadronElasticPhysics.hh" @@ -29,7 +29,7 @@ LaserOpticalPhysics::LaserOpticalPhysics(const edm::ParameterSet &p) : PhysicsLi << std::endl; // EM Physics - RegisterPhysics(new CMSEmStandardPhysics(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics RegisterPhysics(new G4EmExtraPhysics(ver)); // Decays diff --git a/CUDADataFormats/HGCal/BuildFile.xml b/CUDADataFormats/HGCal/BuildFile.xml index 60e10acaa6829..a833b9a64ed59 100644 --- a/CUDADataFormats/HGCal/BuildFile.xml +++ b/CUDADataFormats/HGCal/BuildFile.xml @@ -1,6 +1,6 @@ - - - + + + diff --git a/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h b/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h index e9dfed7bca7a6..77cf567dca681 100644 --- a/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h +++ b/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h @@ -4,17 +4,6 @@ #include #include -namespace pixelGPUConstants { -#ifdef GPU_SMALL_EVENTS - // kept for testing and debugging - constexpr uint32_t maxNumberOfHits = 24 * 1024; -#else - // data at pileup 50 has 18300 +/- 3500 hits; 40000 is around 6 sigma away - // tested on MC events with 55-75 pileup events - constexpr uint32_t maxNumberOfHits = 48 * 1024; -#endif -} // namespace pixelGPUConstants - namespace gpuClustering { #ifdef GPU_SMALL_EVENTS // kept for testing and debugging @@ -28,7 +17,6 @@ namespace gpuClustering { constexpr uint16_t maxNumModules = 2000; constexpr int32_t maxNumClustersPerModules = maxHitsInModule(); - constexpr uint32_t maxNumClusters = pixelGPUConstants::maxNumberOfHits; constexpr uint16_t invalidModuleId = std::numeric_limits::max() - 1; static_assert(invalidModuleId > maxNumModules); // invalidModuleId must be > maxNumModules diff --git a/CUDADataFormats/Track/interface/TrackSoAHeterogeneousT.h b/CUDADataFormats/Track/interface/TrackSoAHeterogeneousT.h index bd39f3c4d3bfe..f74717c41e4d7 100644 --- a/CUDADataFormats/Track/interface/TrackSoAHeterogeneousT.h +++ b/CUDADataFormats/Track/interface/TrackSoAHeterogeneousT.h @@ -17,7 +17,7 @@ class TrackSoAHeterogeneousT { using Quality = pixelTrack::Quality; using hindex_type = uint32_t; - using HitContainer = cms::cuda::OneToManyAssoc; + using HitContainer = cms::cuda::OneToManyAssoc; // Always check quality is at least loose! // CUDA does not support enums in __lgc ... diff --git a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h index 967b5c6c8282f..7fa73432100f9 100644 --- a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h +++ b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h @@ -34,6 +34,7 @@ class TrackingRecHit2DHeterogeneous { auto hitsModuleStart() const { return m_hitsModuleStart; } auto hitsLayerStart() { return m_hitsLayerStart; } auto phiBinner() { return m_phiBinner; } + auto phiBinnerStorage() { return m_phiBinnerStorage; } auto iphi() { return m_iphi; } // only the local coord and detector index @@ -42,7 +43,7 @@ class TrackingRecHit2DHeterogeneous { private: static constexpr uint32_t n16 = 4; // number of elements in m_store16 - static constexpr uint32_t n32 = 9; // number of elements in m_store32 + static constexpr uint32_t n32 = 10; // number of elements in m_store32 static_assert(sizeof(uint32_t) == sizeof(float)); // just stating the obvious unique_ptr m_store16; //! @@ -59,6 +60,7 @@ class TrackingRecHit2DHeterogeneous { // needed as kernel params... PhiBinner* m_phiBinner; + PhiBinner::index_type* m_phiBinnerStorage; uint32_t* m_hitsLayerStart; int16_t* m_iphi; }; @@ -97,14 +99,20 @@ TrackingRecHit2DHeterogeneous::TrackingRecHit2DHeterogeneous(uint32_t nH // this will break 1to1 correspondence with cluster and module locality // so unless proven VERY inefficient we keep it ordered as generated m_store16 = Traits::template make_device_unique(nHits * n16, stream); - m_store32 = Traits::template make_device_unique(nHits * n32 + 11, stream); + m_store32 = + Traits::template make_device_unique(nHits * n32 + phase1PixelTopology::numberOfLayers + 1, stream); m_PhiBinnerStore = Traits::template make_device_unique(stream); + static_assert(sizeof(TrackingRecHit2DSOAView::hindex_type) == sizeof(float)); + static_assert(sizeof(TrackingRecHit2DSOAView::hindex_type) == sizeof(TrackingRecHit2DSOAView::PhiBinner::index_type)); + auto get16 = [&](int i) { return m_store16.get() + i * nHits; }; auto get32 = [&](int i) { return m_store32.get() + i * nHits; }; // copy all the pointers m_phiBinner = view->m_phiBinner = m_PhiBinnerStore.get(); + m_phiBinnerStorage = view->m_phiBinnerStorage = + reinterpret_cast(get32(9)); view->m_xl = get32(0); view->m_yl = get32(1); diff --git a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DSOAView.h b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DSOAView.h index 7f3c59cd70faf..bebca103158ed 100644 --- a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DSOAView.h +++ b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DSOAView.h @@ -14,11 +14,9 @@ namespace pixelCPEforGPU { class TrackingRecHit2DSOAView { public: - static constexpr uint32_t maxHits() { return gpuClustering::maxNumClusters; } using hindex_type = uint32_t; // if above is <=2^32 - using PhiBinner = - cms::cuda::HistoContainer; + using PhiBinner = cms::cuda::HistoContainer; using AverageGeometry = phase1PixelTopology::AverageGeometry; @@ -95,6 +93,7 @@ class TrackingRecHit2DSOAView { uint32_t* m_hitsLayerStart; PhiBinner* m_phiBinner; + PhiBinner::index_type* m_phiBinnerStorage; uint32_t m_nHits; }; diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TFParams.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TFParams.h index 0af886ef14126..15c58ce2c33a7 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TFParams.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TFParams.h @@ -23,10 +23,7 @@ #include "TVirtualX.h" #include "TObject.h" //#include "TMatrixD.h" -#define SDIM2 10 /* number of samples for cristal */ -#define PLSHDIM 650 /* size of the pulse shape array */ - //double pulseShape( Double_t x[1], Double_t par[4] ) ; - // + struct matrice { int nb_lignes; int nb_colonnes; @@ -38,11 +35,14 @@ matrice cree_mat_prod(matrice, matrice); void fill_mat(matrice, matrice); matrice fill_mat_int(matrice, matrice, matrice); -#define dimmat 30 -#define dimout 10 -#define nbmax_cell 1000 - class TFParams : public TObject { +public: + static constexpr unsigned int dimmat = 30; + static constexpr unsigned int dimout = 10; + static constexpr unsigned int nbmax_cell = 1000; + static constexpr int SDIM2 = 10; + static constexpr int PLSHDIM = 650; + private: int ns; // number of samples int nsmin; // beginning of fit @@ -57,6 +57,8 @@ class TFParams : public TObject { int METHODE; public: + /* number of samples for cristal */ + /* size of the pulse shape array */ TFParams(int size = SDIM2, int size_sh = PLSHDIM); ~TFParams() override{}; double fitpj(double **, double *, double **, double noise_val, int debug); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMCReader.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMCReader.h index 34b76482c15aa..04a1e4ad4a490 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMCReader.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMCReader.h @@ -3,69 +3,62 @@ #include "TObject.h" -#define FNPNMAX 10 -#define FNLMODNMAX 9 -#define FNCHANMAX 200 - -#define fNpns 2 -#define fNchans 400 -#define fNbins 102 - -class TMCReader: public TObject -{ - - private: - - int smN,nlmodN,arr[FNLMODNMAX]; - long int timestart,timestop; - float evts[fNpns+1][FNCHANMAX+FNPNMAX]; - double min[fNpns+1][FNCHANMAX+FNPNMAX],max[fNpns+1][FNCHANMAX+FNPNMAX]; - double val[fNpns+1][FNCHANMAX+FNPNMAX],sig[fNpns+1][FNCHANMAX+FNPNMAX]; - double wbin[fNpns+1][FNCHANMAX+FNPNMAX]; +class TMCReader : public TObject { +public: + static constexpr unsigned int FNPNMAX = 10; + static constexpr unsigned int FNLMODNMAX = 9; + static constexpr unsigned int FNCHANMAX = 200; + static constexpr unsigned int fNpns = 2; + static constexpr unsigned int fNchans = 400; + static constexpr unsigned int fNbins = 102; + +private: + int smN, nlmodN, arr[FNLMODNMAX]; + long int timestart, timestop; + float evts[fNpns + 1][FNCHANMAX + FNPNMAX]; + double min[fNpns + 1][FNCHANMAX + FNPNMAX], max[fNpns + 1][FNCHANMAX + FNPNMAX]; + double val[fNpns + 1][FNCHANMAX + FNPNMAX], sig[fNpns + 1][FNCHANMAX + FNPNMAX]; + double wbin[fNpns + 1][FNCHANMAX + FNPNMAX]; float sumprob; - int smlocal,color,lmdir,part; + int smlocal, color, lmdir, part; void init(); - public: +public: // Default Constructor, mainly for Root TMCReader(); // Destructor: Does nothing virtual ~TMCReader(); - void validMCLaser(int,int); - void getMCLaserData(int,int); + void validMCLaser(int, int); + void getMCLaserData(int, int); void validMCPulse(int); void getMCPulseData(int); - int getSMNumb() {return smN;} - int getNbOflmodN() {return nlmodN;} - int getlmodN(int indx) {return arr[indx];} - int getstartime() {return timestart;} - int getstoptime() {return timestop;} - int getnevts(int norm) {return (int) evts[norm][0];} + int getSMNumb() { return smN; } + int getNbOflmodN() { return nlmodN; } + int getlmodN(int indx) { return arr[indx]; } + int getstartime() { return timestart; } + int getstoptime() { return timestop; } + int getnevts(int norm) { return (int)evts[norm][0]; } - void setsmlocal(int sm) {smlocal=sm;} - void setcolor(int c) {color=c;} - void setdirlmodN(int lmp) {lmdir=lmp;} - void setpartition(int p) {part=p;} + void setsmlocal(int sm) { smlocal = sm; } + void setcolor(int c) { color = c; } + void setdirlmodN(int lmp) { lmdir = lmp; } + void setpartition(int p) { part = p; } - void changedatatoraw(int,int,int); - void changedatatopeak(int,int,int); - - void printeinjData(int,int,int); - void printlaserData(int,int,int,int); - void printlaserpeak(int,int,int); - void printnormlaserData(int,int,int,int,int); - void printnormlaserpeak(int,int,int,int); + void changedatatoraw(int, int, int); + void changedatatopeak(int, int, int); + void printeinjData(int, int, int); + void printlaserData(int, int, int, int); + void printlaserpeak(int, int, int); + void printnormlaserData(int, int, int, int, int); + void printnormlaserpeak(int, int, int, int); // ClassDef(TMCReader,1) }; #endif - - - diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMConfig.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMConfig.h index 7cc110071d3ff..3a56395a9ace3 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMConfig.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMConfig.h @@ -3,32 +3,31 @@ #include "TObject.h" -#define fNsmNmax 36 //number of SM -#define fNlmodN 9 //number of lmodN in a SM -#define fNmem 10 //number of PNs in a MEM -#define fNmodN 4 //number of modN in a SM -#define fNtt 68 //number of trigger towers in a SM -#define fNmax 8 -#define fNburmax 3 -#define fNseqmax 3 -#define fNcolors 6 //number of laser colors - -class TMConfig: public TObject -{ - - private: +class TMConfig : public TObject { +public: + static constexpr unsigned int fNsmNmax = 36; //number of SM + static constexpr unsigned int fNlmodN = 9; //number of lmodN in a SM + static constexpr unsigned int fNmem = 10; //number of PNs in a MEM + static constexpr unsigned int fNmodN = 4; //number of modN in a SM + static constexpr unsigned int fNtt = 68; //number of trigger towers in a SM + static constexpr unsigned int fNmax = 8; + static constexpr unsigned int fNburmax = 3; + static constexpr unsigned int fNseqmax = 3; + static constexpr unsigned int fNcolors = 6; //number of laser colors + +private: int smin; - int arr[fNsmNmax+1][fNmodN+1]; - int nbof[fNsmNmax+1][fNlmodN+1]; - int towerlist[fNsmNmax+1][fNlmodN][fNmax+1]; - int channlist[fNsmNmax+1][fNlmodN][fNmax+1]; - int addrpn[fNsmNmax+1][fNmodN+1][fNmem]; - int n_pin[fNsmNmax+1][fNmodN+1]; - int seqTypeOfSignal[fNseqmax+1],numbOfEventperBurstAndSignal[fNseqmax+1]; - int numbOfBurstperSignal[fNseqmax+1]; - int ped_size[fNburmax+1],laser_size[fNcolors][fNseqmax+1]; - double alpha[fNcolors],beta[fNcolors]; - double alpha_run[fNcolors][fNsmNmax+1][fNtt],beta_run[fNcolors][fNsmNmax+1][fNtt]; + int arr[fNsmNmax + 1][fNmodN + 1]; + int nbof[fNsmNmax + 1][fNlmodN + 1]; + int towerlist[fNsmNmax + 1][fNlmodN][fNmax + 1]; + int channlist[fNsmNmax + 1][fNlmodN][fNmax + 1]; + int addrpn[fNsmNmax + 1][fNmodN + 1][fNmem]; + int n_pin[fNsmNmax + 1][fNmodN + 1]; + int seqTypeOfSignal[fNseqmax + 1], numbOfEventperBurstAndSignal[fNseqmax + 1]; + int numbOfBurstperSignal[fNseqmax + 1]; + int ped_size[fNburmax + 1], laser_size[fNcolors][fNseqmax + 1]; + double alpha[fNcolors], beta[fNcolors]; + double alpha_run[fNcolors][fNsmNmax + 1][fNtt], beta_run[fNcolors][fNsmNmax + 1][fNtt]; void init(); void readSequenzaConfig(); @@ -46,63 +45,62 @@ class TMConfig: public TObject double alpha_start, beta_start; int firstpnSample, lastpnSample; - int nbofiter,nbofpresamp,samplemin,samplemax; + int nbofiter, nbofpresamp, samplemin, samplemax; int nbofpnpresamp, nbofpnsamp, nbofsamp; - int nbofmtqsamples,nbofmtqpresamp,vlastmtqsample,nbofmtqsigmas; - int nbofmtqsamp1esbeforemax_parab,nbofmtqsamplesaftermax_parab; - int thres_mtq,ampllow_trise,amplhigh_trise; + int nbofmtqsamples, nbofmtqpresamp, vlastmtqsample, nbofmtqsigmas; + int nbofmtqsamp1esbeforemax_parab, nbofmtqsamplesaftermax_parab; + int thres_mtq, ampllow_trise, amplhigh_trise; - public: +public: // Default Constructor, mainly for Root TMConfig(); // Destructor: Does nothing virtual ~TMConfig(); - int getfirstSM() {return smin;} - int getfirstSample() {return firstSample;} - int getlastSample() {return lastSample;} - int getfirstPNSample() {return firstpnSample;} - int getlastPNSample() {return lastpnSample;} - float getalpha0() {return alpha_start;} - float getbeta0() {return beta_start;} - int getsampleMin() {return samplemin;} - int getsampleMax() {return samplemax;} - int getNbOfxtalpresamples() {return nbofpresamp;} - int getNbOfPNpresamples() {return nbofpnpresamp;} - int getNbOfiterations() {return nbofiter;} - int getNbOfPNsamples() { return nbofpnsamp;} - int getNbOfxtalsamples() { return nbofsamp;} - double getalpha_ls(int c) { return alpha[c];} - double getbeta_ls(int c) { return beta[c];} + int getfirstSM() { return smin; } + int getfirstSample() { return firstSample; } + int getlastSample() { return lastSample; } + int getfirstPNSample() { return firstpnSample; } + int getlastPNSample() { return lastpnSample; } + float getalpha0() { return alpha_start; } + float getbeta0() { return beta_start; } + int getsampleMin() { return samplemin; } + int getsampleMax() { return samplemax; } + int getNbOfxtalpresamples() { return nbofpresamp; } + int getNbOfPNpresamples() { return nbofpnpresamp; } + int getNbOfiterations() { return nbofiter; } + int getNbOfPNsamples() { return nbofpnsamp; } + int getNbOfxtalsamples() { return nbofsamp; } + double getalpha_ls(int c) { return alpha[c]; } + double getbeta_ls(int c) { return beta[c]; } void loadPParams(); - double getalpha_run(int,int,int); - double getbeta_run(int,int,int); - - int getNbOf(int,int); - int getTNumb(int,int,int); - int getXNumb(int,int,int); - int getPNaddr(int,int,int); - int getNbOfPNs(int,int); - - int getNbOfMatacqsamples() {return nbofmtqsamples;} - int getNbOfMatacqpresamples() {return nbofmtqpresamp;} - int getvlastMatacqsample() {return vlastmtqsample;} - int getNoiseCutForMatacq() {return nbofmtqsigmas;} - int getNbOfsamplesBefMax() {return nbofmtqsamp1esbeforemax_parab;} - int getNbOfsamplesAftMax() {return nbofmtqsamplesaftermax_parab;} - int getThresForMatacq() {return thres_mtq;} - int getLowLevelForTRise() {return ampllow_trise;} - int getHighLevelForTRise() {return amplhigh_trise;} - - int getSignalTypeForSeq(int seqNumb) { return seqTypeOfSignal[seqNumb];} - int getNbOfBurstperSignalForSeq(int seqNumb) { return numbOfBurstperSignal[seqNumb];} - int getNbOfEventperBurstAndSignalForSeq(int seqNumb) { return numbOfEventperBurstAndSignal[seqNumb];} + double getalpha_run(int, int, int); + double getbeta_run(int, int, int); + + int getNbOf(int, int); + int getTNumb(int, int, int); + int getXNumb(int, int, int); + int getPNaddr(int, int, int); + int getNbOfPNs(int, int); + + int getNbOfMatacqsamples() { return nbofmtqsamples; } + int getNbOfMatacqpresamples() { return nbofmtqpresamp; } + int getvlastMatacqsample() { return vlastmtqsample; } + int getNoiseCutForMatacq() { return nbofmtqsigmas; } + int getNbOfsamplesBefMax() { return nbofmtqsamp1esbeforemax_parab; } + int getNbOfsamplesAftMax() { return nbofmtqsamplesaftermax_parab; } + int getThresForMatacq() { return thres_mtq; } + int getLowLevelForTRise() { return ampllow_trise; } + int getHighLevelForTRise() { return amplhigh_trise; } + + int getSignalTypeForSeq(int seqNumb) { return seqTypeOfSignal[seqNumb]; } + int getNbOfBurstperSignalForSeq(int seqNumb) { return numbOfBurstperSignal[seqNumb]; } + int getNbOfEventperBurstAndSignalForSeq(int seqNumb) { return numbOfEventperBurstAndSignal[seqNumb]; } // ClassDef(TMConfig,1) }; #endif - diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMEGeom.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMEGeom.h index fb27a0413fc63..c2ed19c2daf0c 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMEGeom.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMEGeom.h @@ -3,62 +3,59 @@ #include "TObject.h" -#define nTT 25 +class TMEGeom : public TObject { +public: + static constexpr unsigned int nTT = 25; -class TMEGeom: public TObject -{ +private: + int ttindarr[5][5]; - private: - - int ttindarr[5][5]; - - - public: +public: // Default Constructor, mainly for Root TMEGeom(); // Destructor: Does nothing virtual ~TMEGeom(); -int nbOfXTalinmodN(int); -int nbOfXTalinlmodN(int); - -int xtaltoadcn(int); -int adcltoxtal(int,int); -int adcltoadcn(int,int); -int adcltotNumb(int,int); -int adcmtoadcn(int,int); -int adcmtoadcl(int,int,int); -int adcntoadcm(int); -int adcntomodN(int); -int adcntolmodN(int,int); -int adcntoxtal(int); -int tNumbtomodN(int); -int tNumbtomodulN(int); -int tNumbtolmodN(int); -int tNumbtoside(int); -int lmodNtoside(int); -int lmodNtomodN(int); -int lmodNtolmcha(int); - -int modN_offset(int); -int lmodN_offset(int); - -int adcntoij(int); -int adcltoij(int,int); -int ijtoadcn(int,int); -int ijtoadcl(int,int,int); - -int tNumbtolvcha(int); -int tNumbtohvcha(int); -int adcltolvcha(int,int); -int adcltohvcha(int,int); - -int hvchatolvcha(int); - -void tNumbtoij(int); - -// ClassDef(TMEGeom,1) + int nbOfXTalinmodN(int); + int nbOfXTalinlmodN(int); + + int xtaltoadcn(int); + int adcltoxtal(int, int); + int adcltoadcn(int, int); + int adcltotNumb(int, int); + int adcmtoadcn(int, int); + int adcmtoadcl(int, int, int); + int adcntoadcm(int); + int adcntomodN(int); + int adcntolmodN(int, int); + int adcntoxtal(int); + int tNumbtomodN(int); + int tNumbtomodulN(int); + int tNumbtolmodN(int); + int tNumbtoside(int); + int lmodNtoside(int); + int lmodNtomodN(int); + int lmodNtolmcha(int); + + int modN_offset(int); + int lmodN_offset(int); + + int adcntoij(int); + int adcltoij(int, int); + int ijtoadcn(int, int); + int ijtoadcl(int, int, int); + + int tNumbtolvcha(int); + int tNumbtohvcha(int); + int adcltolvcha(int, int); + int adcltohvcha(int, int); + + int hvchatolvcha(int); + + void tNumbtoij(int); + + // ClassDef(TMEGeom,1) }; #endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMatacq.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMatacq.h index 7241e9631b9ae..f1a8111388643 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TMatacq.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TMatacq.h @@ -3,10 +3,11 @@ #include "TObject.h" -#define NMAXSAMP 100 -#define NSPARAB 16 - class TMatacq : public TObject { +public: + static constexpr int NMAXSAMP = 100; + static constexpr int NSPARAB = 16; + private: int fNsamples; int fNum_samp_bef_max; diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TPEDestalAnalysis.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TPEDestalAnalysis.h index cafa6a2ea3231..abcf8f656c8d3 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TPEDestalAnalysis.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TPEDestalAnalysis.h @@ -3,28 +3,26 @@ #include "TObject.h" -#define fNpns 2 -#define fNchans 400 -#define ngains 3 - -class TPEDestalAnalysis: public TObject -{ - - private: +class TPEDestalAnalysis : public TObject { +public: + static constexpr unsigned int fNpns = 2; + static constexpr unsigned int fNchans = 400; + static constexpr unsigned int ngains = 3; +private: int nevt; - long int timestart[ngains],timestop[ngains]; - long int pntimestart[ngains],pntimestop[ngains]; - double valhf[ngains][fNchans+fNpns],sighf[ngains][fNchans+fNpns]; - double valbf[ngains][fNchans+fNpns],sigbf[ngains][fNchans+fNpns]; - double evts[ngains][fNchans+fNpns],evtn[ngains][fNchans+fNpns]; + long int timestart[ngains], timestop[ngains]; + long int pntimestart[ngains], pntimestop[ngains]; + double valhf[ngains][fNchans + fNpns], sighf[ngains][fNchans + fNpns]; + double valbf[ngains][fNchans + fNpns], sigbf[ngains][fNchans + fNpns]; + double evts[ngains][fNchans + fNpns], evtn[ngains][fNchans + fNpns]; - double cuthflow[ngains][fNchans+fNpns],cuthfhig[ngains][fNchans+fNpns]; - double cutbflow[ngains][fNchans+fNpns],cutbfhig[ngains][fNchans+fNpns]; + double cuthflow[ngains][fNchans + fNpns], cuthfhig[ngains][fNchans + fNpns]; + double cutbflow[ngains][fNchans + fNpns], cutbfhig[ngains][fNchans + fNpns]; void init(); - public: +public: // Default Constructor, mainly for Root TPEDestalAnalysis(); @@ -33,18 +31,18 @@ class TPEDestalAnalysis: public TObject void reinit(); void reinit(int); - void putDateStart(int,long int); - void putDateStop(int,long int); - void putpnDateStart(int,long int); - void putpnDateStop(int,long int); + void putDateStart(int, long int); + void putDateStop(int, long int); + void putpnDateStart(int, long int); + void putpnDateStop(int, long int); void getDateStart(int); void getDateStop(int); - double getCuthflow(int g,int i) {return cuthflow[g][i];} - double getCutbfhig(int g,int i) {return cutbfhig[g][i];} - void putValues(int,int,double,double,double); - void putValuesWithCuts(int,int,double,double,double); - void computepedestalcuts(int,int,int,int); - void printpedestalData(int,int,int,int,int,int); + double getCuthflow(int g, int i) { return cuthflow[g][i]; } + double getCutbfhig(int g, int i) { return cutbfhig[g][i]; } + void putValues(int, int, double, double, double); + void putValuesWithCuts(int, int, double, double, double); + void computepedestalcuts(int, int, int, int); + void printpedestalData(int, int, int, int, int, int); // ClassDef(TPEDestalAnalysis,1) }; diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TPNFit.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TPNFit.h index 15b1d3552b75b..7e768f8b5fde8 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TPNFit.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TPNFit.h @@ -3,9 +3,10 @@ #include "TObject.h" -#define NMAXSAMP2 50 - class TPNFit : public TObject { +public: + static constexpr int NMAXSAMP2 = 50; + private: int fNsamples; int fNum_samp_bef_max; diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TSFit.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TSFit.h index 2e8d1414d4b02..b88aa72943ffb 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TSFit.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TSFit.h @@ -1,18 +1,17 @@ #ifndef TSFit_H #define TSFit_H -#define SDIM 14 /* default number of samples for cristal */ -#define PLSHDIM 650 /* default size of the pulse shape array */ -//these 2 last parameters are overwritten in constructor - -#define matdim 5 /* parameters fit max matrice size */ -#define diminpar 10 -#define dimoutpar 10 -#define npar_moni 4 - #include "TObject.h" class TSFit : public TObject { +public: + static constexpr unsigned int SDIM = 14; /* default number of samples for cristal */ + static constexpr unsigned int PLSHDIM = 650; /* default size of the pulse shape array */ + static constexpr int matdim = 5; /* parameters fit max matrice size */ + static constexpr unsigned int diminpar = 10; + static constexpr unsigned int dimoutpar = 10; + static constexpr unsigned int npar_moni = 4; + private: /* nbs = nb of samples in sample data array[sdim] nbs<=sdim diff --git a/CalibCalorimetry/EcalLaserAnalyzer/interface/TShapeAnalysis.h b/CalibCalorimetry/EcalLaserAnalyzer/interface/TShapeAnalysis.h index ea4447c345448..d193184207451 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/interface/TShapeAnalysis.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/interface/TShapeAnalysis.h @@ -5,9 +5,10 @@ #include class TTree; -#define fNchsel 1700 - class TShapeAnalysis : public TObject { +public: + static constexpr int fNchsel = 1700; + private: char filename[80]; long int timestart, timestop; diff --git a/CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h b/CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h index 854539eb90523..9c839995352ff 100644 --- a/CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h +++ b/CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h @@ -3,8 +3,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" - +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" @@ -16,7 +15,14 @@ class EcalReadoutTools { const EcalElectronicsMapping* elecMap_; public: - EcalReadoutTools(const edm::Event& iEvent, const edm::EventSetup& iSetup); + struct ESGetTokens { + ESGetTokens(const edm::ParameterSet&, edm::ConsumesCollector&& iC) + : ecalTrigTowerConstituentsMapToken{iC.esConsumes()}, ecalElectronicsMappingToken{iC.esConsumes()} {} + edm::ESGetToken const ecalTrigTowerConstituentsMapToken; + edm::ESGetToken const ecalElectronicsMappingToken; + }; + + EcalReadoutTools(const edm::Event&, const edm::EventSetup&, const ESGetTokens&); EcalReadoutTools(const EcalReadoutTools&) = delete; EcalReadoutTools& operator=(const EcalReadoutTools&) = delete; diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc index 9409777c5a677..789682fb420e5 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc @@ -1,6 +1,5 @@ #include "EcalTPGParamBuilder.h" - -#include "CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBApp.h" +#include "EcalTPGDBApp.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" @@ -30,18 +29,15 @@ #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" #include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include -#include -#include -#include -#include #include #include #include #include +#include #include #include +#include using namespace std; @@ -381,11 +377,11 @@ int EcalTPGParamBuilder::getEtaSlice(int tccId, int towerInTCC) { else { if (tccId >= 1 && tccId <= 18) etaSlice += 21; // inner - - if (tccId >= 19 && tccId <= 36) + else if (tccId >= 19 && tccId <= 36) etaSlice += 17; // outer - - if (tccId >= 91 && tccId <= 108) + else if (tccId >= 91 && tccId <= 108) etaSlice += 21; // inner + - if (tccId >= 73 && tccId <= 90) + else if (tccId >= 73 && tccId <= 90) etaSlice += 17; // outer + } return etaSlice; @@ -1109,13 +1105,11 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedDB.setPedMeanG12(itLin->second.pedestal_[i]); linDB.setMultX12(itLin->second.mult_[i]); linDB.setShift12(itLin->second.shift_[i]); - } - if (i == 1) { + } else if (i == 1) { pedDB.setPedMeanG6(itLin->second.pedestal_[i]); linDB.setMultX6(itLin->second.mult_[i]); linDB.setShift6(itLin->second.shift_[i]); - } - if (i == 2) { + } else if (i == 2) { pedDB.setPedMeanG1(itLin->second.pedestal_[i]); linDB.setMultX1(itLin->second.mult_[i]); linDB.setShift1(itLin->second.shift_[i]); @@ -1134,6 +1128,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // general case linStruc lin; int forceBase12 = 0; + double invSinTheta = 1. / sin(theta); for (int i = 0; i < 3; i++) { int mult, shift; bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EB", mult, shift); @@ -1149,12 +1144,10 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // if (i==2) {mult = 0xc0 ; shift = 0x0 ;} // } //PP end - double base = coeff.pedestals_[i]; if (forcedPedestalValue_ == -3 && i == 0) { double G = mult * pow(2.0, -(shift + 2)); - double g = G / sin(theta); - // int pedestal = coeff.pedestals_[i] ; - base = double(coeff.pedestals_[i]) - pedestal_offset_ / g; + double g = G * invSinTheta; + double base = double(coeff.pedestals_[i]) - pedestal_offset_ / g; if (base < 0.) base = 0; forceBase12 = int(base); @@ -1175,7 +1168,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& bool ok(true); if (forcedPedestalValue_ == -2) ok = realignBaseline(lin, 0); - if (forcedPedestalValue_ == -3) + else if (forcedPedestalValue_ == -3) ok = realignBaseline(lin, forceBase12); if (!ok) ss << "SM=" << id.ism() << " xt=" << id.ic() << " " << dec << id.rawId() << "\n"; @@ -1189,13 +1182,11 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedDB.setPedMeanG12(lin.pedestal_[i]); linDB.setMultX12(lin.mult_[i]); linDB.setShift12(lin.shift_[i]); - } - if (i == 1) { + } else if (i == 1) { pedDB.setPedMeanG6(lin.pedestal_[i]); linDB.setMultX6(lin.mult_[i]); linDB.setShift6(lin.shift_[i]); - } - if (i == 2) { + } else if (i == 2) { pedDB.setPedMeanG1(lin.pedestal_[i]); linDB.setMultX1(lin.mult_[i]); linDB.setShift1(lin.shift_[i]); @@ -1209,7 +1200,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& factor); } double G = lin.mult_[i] * pow(2.0, -(lin.shift_[i] + 2)); - double g = G / sin(theta); + double g = G * invSinTheta; float val[] = {float(i), float(theta), float(G), @@ -1454,13 +1445,11 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedDB.setPedMeanG12(itLin->second.pedestal_[i]); linDB.setMultX12(itLin->second.mult_[i]); linDB.setShift12(itLin->second.shift_[i]); - } - if (i == 1) { + } else if (i == 1) { pedDB.setPedMeanG6(itLin->second.pedestal_[i]); linDB.setMultX6(itLin->second.mult_[i]); linDB.setShift6(itLin->second.shift_[i]); - } - if (i == 2) { + } else if (i == 2) { pedDB.setPedMeanG1(itLin->second.pedestal_[i]); linDB.setMultX1(itLin->second.mult_[i]); linDB.setShift1(itLin->second.shift_[i]); @@ -1508,13 +1497,11 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedDB.setPedMeanG12(lin.pedestal_[i]); linDB.setMultX12(lin.mult_[i]); linDB.setShift12(lin.shift_[i]); - } - if (i == 1) { + } else if (i == 1) { pedDB.setPedMeanG6(lin.pedestal_[i]); linDB.setMultX6(lin.mult_[i]); linDB.setShift6(lin.shift_[i]); - } - if (i == 2) { + } else if (i == 2) { pedDB.setPedMeanG1(lin.pedestal_[i]); linDB.setMultX1(lin.mult_[i]); linDB.setShift1(lin.shift_[i]); diff --git a/CalibCalorimetry/EcalTPGTools/src/EcalReadoutTools.cc b/CalibCalorimetry/EcalTPGTools/src/EcalReadoutTools.cc index 882f9ee467d9b..b6d3f8d879194 100644 --- a/CalibCalorimetry/EcalTPGTools/src/EcalReadoutTools.cc +++ b/CalibCalorimetry/EcalTPGTools/src/EcalReadoutTools.cc @@ -1,13 +1,8 @@ #include "CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h" -EcalReadoutTools::EcalReadoutTools(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle hTriggerTowerMap; - iSetup.get().get(hTriggerTowerMap); - triggerTowerMap_ = hTriggerTowerMap.product(); - - edm::ESHandle ecalmapping; - iSetup.get().get(ecalmapping); - elecMap_ = ecalmapping.product(); +EcalReadoutTools::EcalReadoutTools(const edm::Event&, const edm::EventSetup& iSetup, const ESGetTokens& esGetTokens) { + triggerTowerMap_ = &iSetup.getData(esGetTokens.ecalTrigTowerConstituentsMapToken); + elecMap_ = &iSetup.getData(esGetTokens.ecalElectronicsMappingToken); } EcalTrigTowerDetId EcalReadoutTools::readOutUnitOf(const EBDetId& xtalId) const { diff --git a/CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h b/CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h new file mode 100644 index 0000000000000..2d847dcdfe6f4 --- /dev/null +++ b/CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h @@ -0,0 +1,17 @@ +#ifndef CalibPPS_TimingCalibration_TimingCalibrationStruct_h +#define CalibPPS_TimingCalibration_TimingCalibrationStruct_h + +#include "DQMServices/Core/interface/DQMStore.h" +#include + +struct TimingCalibrationHistograms { +public: + TimingCalibrationHistograms() = default; + + using MonitorMap = std::unordered_map; + + MonitorMap leadingTime, toT; + MonitorMap leadingTimeVsToT; +}; + +#endif diff --git a/CalibPPS/TimingCalibration/plugins/BuildFile.xml b/CalibPPS/TimingCalibration/plugins/BuildFile.xml new file mode 100644 index 0000000000000..b67b7d23683d5 --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/BuildFile.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc b/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc new file mode 100644 index 0000000000000..9e2a43cdbb3fd --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc @@ -0,0 +1,160 @@ +/**************************************************************************** + * + * This is a part of PPS offline software. + * Authors: + * Edoardo Bossini + * Piotr Maciej Cwiklicki + * Laurent Forthomme + * + ****************************************************************************/ + +#include "DQMServices/Core/interface/DQMEDHarvester.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" + +#include "CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" + +//------------------------------------------------------------------------------ + +class PPSTimingCalibrationPCLHarvester : public DQMEDHarvester { +public: + PPSTimingCalibrationPCLHarvester(const edm::ParameterSet&); + void beginRun(const edm::Run&, const edm::EventSetup&) override; + + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override; + edm::ESGetToken geomEsToken_; + std::vector detids_; + const std::string dqmDir_; + const std::string formula_; + const unsigned int min_entries_; + TF1 interp_; +}; + +//------------------------------------------------------------------------------ + +PPSTimingCalibrationPCLHarvester::PPSTimingCalibrationPCLHarvester(const edm::ParameterSet& iConfig) + : geomEsToken_(esConsumes()), + dqmDir_(iConfig.getParameter("dqmDir")), + formula_(iConfig.getParameter("formula")), + min_entries_(iConfig.getParameter("minEntries")), + interp_("interp", formula_.c_str(), 10.5, 25.) { + // first ensure DB output service is available + edm::Service poolDbService; + if (!poolDbService.isAvailable()) + throw cms::Exception("PPSTimingCalibrationPCLHarvester") << "PoolDBService required"; + + // constrain the min/max fit values + interp_.SetParLimits(1, 9., 15.); + interp_.SetParLimits(2, 0.2, 2.5); +} + +//------------------------------------------------------------------------------ + +void PPSTimingCalibrationPCLHarvester::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + const auto& geom = iSetup.getData(geomEsToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + if (detid.station() == 1) // for the time being, only compute for this station (run 2 diamond) + detids_.emplace_back(detid); + } +} + +//------------------------------------------------------------------------------ + +void PPSTimingCalibrationPCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { + // book the parameters containers + PPSTimingCalibration::ParametersMap calib_params; + PPSTimingCalibration::TimingMap calib_time; + + iGetter.cd(); + iGetter.setCurrentFolder(dqmDir_); + + // compute the fit parameters for all monitored channels + TimingCalibrationHistograms hists; + std::string ch_name; + for (const auto& detid : detids_) { + detid.channelName(ch_name); + const auto chid = detid.rawId(); + const PPSTimingCalibration::Key key{ + (int)detid.arm(), (int)detid.station(), (int)detid.plane(), (int)detid.channel()}; + hists.leadingTime[chid] = iGetter.get("t_" + ch_name); + if (hists.leadingTime[chid] == nullptr) { + edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve leading time monitor for channel (" << detid << ")."; + continue; + } + hists.toT[chid] = iGetter.get("tot_" + ch_name); + if (hists.toT[chid] == nullptr) { + edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve time over threshold monitor for channel (" << detid << ")."; + continue; + } + hists.leadingTimeVsToT[chid] = iGetter.get("tvstot_" + ch_name); + if (hists.leadingTimeVsToT[chid] == nullptr) { + edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve leading time vs. time over threshold monitor for channel (" << detid << ")."; + continue; + } + if (min_entries_ > 0 && hists.leadingTimeVsToT[chid]->getEntries() < min_entries_) { + edm::LogWarning("PPSTimingCalibrationPCLHarvester:dqmEndJob") + << "Not enough entries for channel (" << detid << "): " << hists.leadingTimeVsToT[chid]->getEntries() << " < " + << min_entries_ << ". Skipping calibration."; + continue; + } + const double upper_tot_range = hists.toT[chid]->getMean() + 2.5; + { // scope for x-profile + std::unique_ptr prof(hists.leadingTimeVsToT[chid]->getTH2D()->ProfileX("_prof_x", 1, -1)); + interp_.SetParameters(hists.leadingTime[chid]->getRMS(), + hists.toT[chid]->getMean(), + 0.8, + hists.leadingTime[chid]->getMean() - hists.leadingTime[chid]->getRMS()); + const auto& res = prof->Fit(&interp_, "B+", "", 10.4, upper_tot_range); + if ((bool)res) { + calib_params[key] = { + interp_.GetParameter(0), interp_.GetParameter(1), interp_.GetParameter(2), interp_.GetParameter(3)}; + calib_time[key] = std::make_pair(0.1, 0.); // hardcoded resolution/offset placeholder for the time being + // can possibly do something with interp_.GetChiSquare() in the near future + } else + edm::LogWarning("PPSTimingCalibrationPCLHarvester:dqmEndJob") + << "Fit did not converge for channel (" << detid << ")."; + } + } + + // fill the DB object record + PPSTimingCalibration calib(formula_, calib_params, calib_time); + + // write the object + edm::Service poolDbService; + poolDbService->writeOne(&calib, poolDbService->currentTime(), "PPSTimingCalibrationRcd"); +} + +//------------------------------------------------------------------------------ + +void PPSTimingCalibrationPCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("dqmDir", "AlCaReco/PPSTimingCalibrationPCL") + ->setComment("input path for the various DQM plots"); + desc.add("formula", "[0]/(exp((x-[1])/[2])+1)+[3]") + ->setComment("interpolation formula for the time walk component"); + desc.add("minEntries", 100)->setComment("minimal number of hits to extract calibration"); + descriptions.addWithDefaultLabel(desc); +} + +DEFINE_FWK_MODULE(PPSTimingCalibrationPCLHarvester); diff --git a/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLWorker.cc b/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLWorker.cc new file mode 100644 index 0000000000000..cc3b74c3a970f --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLWorker.cc @@ -0,0 +1,126 @@ +/**************************************************************************** + * + * This is a part of PPS offline software. + * Authors: + * Edoardo Bossini + * Piotr Maciej Cwiklicki + * Laurent Forthomme + * + ****************************************************************************/ + +#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" + +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h" + +#include "CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h" + +//------------------------------------------------------------------------------ + +class PPSTimingCalibrationPCLWorker : public DQMGlobalEDAnalyzer { +public: + explicit PPSTimingCalibrationPCLWorker(const edm::ParameterSet&); + + void dqmAnalyze(const edm::Event&, const edm::EventSetup&, const TimingCalibrationHistograms&) const override; + + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + void bookHistograms(DQMStore::IBooker&, + const edm::Run&, + const edm::EventSetup&, + TimingCalibrationHistograms&) const override; + + edm::EDGetTokenT> diamondRecHitToken_; + edm::ESGetToken geomEsToken_; + + const std::string dqmDir_; +}; + +//------------------------------------------------------------------------------ + +PPSTimingCalibrationPCLWorker::PPSTimingCalibrationPCLWorker(const edm::ParameterSet& iConfig) + : diamondRecHitToken_( + consumes>(iConfig.getParameter("diamondRecHitTag"))), + geomEsToken_(esConsumes()), + dqmDir_(iConfig.getParameter("dqmDir")) {} + +//------------------------------------------------------------------------------ + +void PPSTimingCalibrationPCLWorker::bookHistograms(DQMStore::IBooker& iBooker, + const edm::Run& iRun, + const edm::EventSetup& iSetup, + TimingCalibrationHistograms& iHists) const { + iBooker.cd(); + iBooker.setCurrentFolder(dqmDir_); + std::string ch_name; + + const auto& geom = iSetup.getData(geomEsToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + if (detid.station() != 1) + continue; + detid.channelName(ch_name); + iHists.leadingTime[detid.rawId()] = iBooker.book1D("t_" + ch_name, ch_name + ";t (ns);Entries", 1200, -60., 60.); + iHists.toT[detid.rawId()] = iBooker.book1D("tot_" + ch_name, ch_name + ";ToT (ns);Entries", 100, -20., 20.); + iHists.leadingTimeVsToT[detid.rawId()] = + iBooker.book2D("tvstot_" + ch_name, ch_name + ";ToT (ns);t (ns)", 240, 0., 60., 450, -20., 25.); + } +} + +//------------------------------------------------------------------------------ + +void PPSTimingCalibrationPCLWorker::dqmAnalyze(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const TimingCalibrationHistograms& iHists) const { + // then extract the rechits information for later processing + edm::Handle> dsv_rechits; + iEvent.getByToken(diamondRecHitToken_, dsv_rechits); + // ensure timing detectors rechits are found in the event content + if (dsv_rechits->empty()) { + edm::LogWarning("PPSTimingCalibrationPCLWorker:dqmAnalyze") << "No rechits retrieved from the event content."; + return; + } + for (const auto& ds_rechits : *dsv_rechits) { + const CTPPSDiamondDetId detid(ds_rechits.detId()); + if (iHists.leadingTimeVsToT.count(detid.rawId()) == 0) { + edm::LogWarning("PPSTimingCalibrationPCLWorker:dqmAnalyze") + << "Pad with detId=" << detid << " is not set to be monitored."; + continue; + } + for (const auto& rechit : ds_rechits) { + // skip invalid rechits + if (rechit.time() == 0. || rechit.toT() < 0.) + continue; + iHists.leadingTime.at(detid.rawId())->Fill(rechit.time()); + iHists.toT.at(detid.rawId())->Fill(rechit.toT()); + iHists.leadingTimeVsToT.at(detid.rawId())->Fill(rechit.toT(), rechit.time()); + } + } +} + +//------------------------------------------------------------------------------ + +void PPSTimingCalibrationPCLWorker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("diamondRecHitTag", edm::InputTag("ctppsDiamondUncalibRecHits")) + ->setComment("input tag for the PPS diamond detectors rechits"); + desc.add("dqmDir", "AlCaReco/PPSTimingCalibrationPCL") + ->setComment("output path for the various DQM plots"); + + descriptions.addWithDefaultLabel(desc); +} + +DEFINE_FWK_MODULE(PPSTimingCalibrationPCLWorker); diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py new file mode 100644 index 0000000000000..1415b8c708f01 --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOPPSCalTrackBasedSel_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOPPSCalTrackBasedSel') + ), + outputCommands = cms.untracked.vstring( + 'keep *_ALCARECOPPSCalTrackBasedSel_*_*', + 'keep *_ctppsDiamondRawToDigi_*_*' + # will be updated to add the spatial alignment required collections + ) +) + +OutALCARECOPPSCalTrackBasedSel = OutALCARECOPPSCalTrackBasedSel_noDrop.clone() +OutALCARECOPPSCalTrackBasedSel.outputCommands.insert(0, 'drop *') diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py new file mode 100644 index 0000000000000..27ad42bb7d8db --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py @@ -0,0 +1,48 @@ +import FWCore.ParameterSet.Config as cms + +# define the HLT base path +from HLTrigger.HLTfilters.hltHighLevel_cfi import hltHighLevel as _hlt +ALCARECOPPSCalTrackBasedSelHLT = _hlt.clone( + andOr = True, + HLTPaths = ['HLT_ZeroBias_v*'], + #eventSetupPathKey = 'SiStripCalZeroBias', # in case we have a proper base key + throw = False +) + +# perform basic PPS reconstruction +from EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff import * +from RecoPPS.Configuration.recoCTPPS_cff import * + +# select events passing the filter on pixel tracks +from HLTrigger.special.hltPPSPerPotTrackFilter_cfi import hltPPSPerPotTrackFilter as _filter +hltPPSPerPotTrackFilter = _filter.clone( + pixelFilter = cms.VPSet( + cms.PSet( # sector 45, near pot + detid = cms.uint32(2022703104), + minTracks = cms.int32(1), + maxTracks = cms.int32(6), + ), + cms.PSet( # sector 45, far pot + detid = cms.uint32(2023227392), + minTracks = cms.int32(1), + maxTracks = cms.int32(6), + ), + cms.PSet( # sector 56, near pot + detid = cms.uint32(2039480320), + minTracks = cms.int32(1), + maxTracks = cms.int32(6), + ), + cms.PSet( # sector 56, far pot + detid = cms.uint32(2040004608), + minTracks = cms.int32(1), + maxTracks = cms.int32(6), + ), + ) +) + +seqALCARECOPPSCalTrackBasedSel = cms.Sequence( + ctppsRawToDigi * + recoCTPPS * + ALCARECOPPSCalTrackBasedSelHLT * + hltPPSPerPotTrackFilter +) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_Output_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_Output_cff.py new file mode 100644 index 0000000000000..149971c7e47c4 --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_Output_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOPPSTimingCalib_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOPPSTimingCalib') + ), + outputCommands = cms.untracked.vstring( + 'keep *_MEtoEDMConvertPPSTimingCalib_*_*', + ) +) + +OutALCARECOPPSTimingCalib = OutALCARECOPPSTimingCalib_noDrop.clone() +OutALCARECOPPSTimingCalib.outputCommands.insert(0, 'drop *') diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_cff.py new file mode 100644 index 0000000000000..45ec0ab492e4c --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSTimingCalib_cff.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +from RecoPPS.Configuration.recoCTPPS_cff import ctppsDiamondRecHits as _ctppsDiamondRecHits +from CalibPPS.TimingCalibration.ppsTimingCalibrationPCLWorker_cfi import ppsTimingCalibrationPCLWorker + +MEtoEDMConvertPPSTimingCalib = cms.EDProducer('MEtoEDMConverter', + Name = cms.untracked.string('MEtoEDMConverter'), + Verbosity = cms.untracked.int32(0), + Frequency = cms.untracked.int32(50), + MEPathToSave = cms.untracked.string('AlCaReco/PPSTimingCalibrationPCL'), + deleteAfterCopy = cms.untracked.bool(True), +) + +# calibrated rechits/tracks +ctppsDiamondUncalibRecHits = _ctppsDiamondRecHits.clone( + applyCalibration = False +) +# this task will be updated to include tracking based on the last +# calibration values to extract per-channel timing precision estimation +recoDiamondUncalibLocalReconstructionTask = cms.Task( + ctppsDiamondUncalibRecHits, +) + +taskALCARECOPPSTimingCalib = cms.Task( + recoDiamondUncalibLocalReconstructionTask, + ppsTimingCalibrationPCLWorker, + MEtoEDMConvertPPSTimingCalib +) diff --git a/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py b/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py new file mode 100644 index 0000000000000..5fcabfa63217e --- /dev/null +++ b/CalibPPS/TimingCalibration/python/PPSTimingCalibrationHarvester_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * +from CalibPPS.TimingCalibration.ppsTimingCalibrationPCLHarvester_cfi import * diff --git a/Calibration/HcalCalibAlgos/macros/CalibCorr.C b/Calibration/HcalCalibAlgos/macros/CalibCorr.C index 3483354403333..9aaae41d5662d 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibCorr.C +++ b/Calibration/HcalCalibAlgos/macros/CalibCorr.C @@ -179,9 +179,9 @@ double puFactor(int type, int ieta, double pmom, double eHcal, double ediff, boo std::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF[icor] << ":" << LINEAR_COR_COEF[icor] << ":" << SQUARE_COR_COEF[icor] << " Fac " << fac; } else { // 21pu - const double CONST_COR_COEF[6] = {0.98555, 0.976956, 0.976892, 0.544262, 0.447506, 0.380405}; - const double LINEAR_COR_COEF[6] = {-0.0452436, -0.140628, -0.229334, -0.0520421, -0.0892927, -0.0810484}; - const double SQUARE_COR_COEF[6] = {0, 0, 0.0333082, 0.00426112, 0.00887433, 0.0085219}; + const double CONST_COR_COEF[6] = {0.98913, 0.982008, 0.974011, 0.496234, 0.368110, 0.294053}; + const double LINEAR_COR_COEF[6] = {-0.0491388, -0.124058, -0.249718, -0.0667390, -0.0770766, -0.0580492}; + const double SQUARE_COR_COEF[6] = {0, 0, 0.0368657, 0.00656337, 0.00724508, 0.00568967}; const int PU_IETA_1 = 7; const int PU_IETA_2 = 16; const int PU_IETA_3 = 25; diff --git a/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C b/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C index d33eb4895d878..7c03062ffcec1 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C +++ b/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C @@ -20,12 +20,18 @@ // PlotHist(infile, prefix, text, modePlot, kopt, lumi, ener, dataMC, // drawStatBox, save); // Defaults: modePlot=4, kopt=100, lumi=0, ener=13, dataMC=false, -// drawStatBox=true, save=false +// drawStatBox=true, save=0 +// +// For plotting histograms corresponding to individual ieta's +// PlotHistEta(infile, prefix, text, iene, numb, ieta, lumi, ener, dataMC, +// drawStatBox, save); +// Defaults iene=3, numb=50, ieta=0, lumi=0, ener=13.0, dataMC=false, +// drawStatBox=true, save=0 // // For plotting several histograms in the same plot // (fits to different data sets for example) // PlotHists(infile, prefix, text, drawStatBox, save) -// Defaults: drawStatBox=true; save=false; +// Defaults: drawStatBox=true; save=0; // Note prefix is common part for all histograms // // For plotting on the same canvas plots with different @@ -33,7 +39,7 @@ // PlotTwoHists(infile, prefix1, text1, prefix2, text2, text0, type, iname, // lumi, ener, drawStatBox, save); // Defaults: type=0; iname=2; lumi=0; ener=13; drawStatBox=true; -// save=false; +// save=0; // Note prefixN, textN have the same meaning as prefix and text for set N // text0 is the text for general title added within () // type=0 plots response distributions and MPV of response vs ieta @@ -44,24 +50,24 @@ // save, prefix1, text1, prefix2, text2, prefix3, text3, // prefix4, text4, prefix5, text5); // Defaults: type=0; iname=0; drawStatBox=true; normalize=false; -// save=false; prefixN=""; textN=""; (for N > 0) +// save=0; prefixN=""; textN=""; (for N > 0) // Note prefixN, textN have the same meaning as prefix and text for set N // text0 is the text for general title added within () // prefix0 is the tag attached to the canvas name // type has the same meaning as in PlotTwoHists // // PlotHistCorrResults(infile, text, prefixF, save); -// Defaults: save=false +// Defaults: save=0 // // For plotting correction factors // PlotHistCorrFactor(infile, text, prefixF, scale, nmin, dataMC, // drawStatBox, save); -// Defaults: dataMC=true, drwaStatBox=false, nmin=100, save=false +// Defaults: dataMC=true, drwaStatBox=false, nmin=100, save=0 // // For plotting (fractional) asymmetry in the correction factors // // PlotHistCorrAsymmetry(infile, text, prefixF, save); -// Defaults: prefixF="", save=false +// Defaults: prefixF="", save=0 // // For plotting correction factors from upto 5 different runs // on the same canvas @@ -70,43 +76,55 @@ // infile4, text4, infile5, text5, prefixF, ratio, // drawStatBox, nmin, dataMC, year, save) // Defaults: ratio=false, drawStatBox=true, nmin=100, dataMC=false, -// year=2018, save=false +// year=2018, save=0 // // For plotting correction factors including systematics // PlotHistCorrSys(infilec, conds, text, save) -// Defaults: save=false +// Defaults: save=0 // // For plotting uncertainties in correction factors with decreasing // integrated luminpsoties starting from *lumi* // PlotHistCorrLumis(infilec, conds, lumi, save) -// Defaults: save=false +// Defaults: save=0 // // For plotting correlation of correction factors // PlotHistCorrRel(infile1, infile2, text1, text2, save) -// Defaults: save=false +// Defaults: save=0 // // For plotting four histograms // PlotFourHists(infile, prefix0, type, drawStatBox, normalize, save, prefix1, // text1, prefix2, text2, prefix3, text3, prefix4, text4) -// Defaults: type=0, drawStatBox=0, normalize=false, save=false, +// Defaults: type=0, drawStatBox=0, normalize=false, save=0, // prefixN="", textN="" // // For plotting PU corrected histograms (o/p of CalibPlotCombine) // PlotPUCorrHists(infile, prefix drawStatBox, approve, save) // Defaults: infile = "corrfac.root", prefix = "", drawStatBox = 0, -// approve = true, save = false +// approve = true, save = 0 // // For plotting histograms obtained from fits to PU correction // (o/p of CalibFitPU) for a given ieta using 2D/profile/Graphs // PlotHistCorr(infile, prefix, text, eta, mode, drawStatBox, save) // Defaults eta = 0 (all ieta values), mode = 1 (profile histograms), -// drawStatBox = true, save = false +// drawStatBox = true, save = 0 // // For plotting histograms created by CalibPlotProperties // PlotPropertyHist(infile, prefix, text, etaMax, lumi, ener, dataMC, // drawStatBox, save) // Defaults etaMax = 25 (draws for eta = 1 .. etaMax), lumi = 0, -// ener = 13.0, dataMC = false, drawStatBox = true, save = false +// ener = 13.0, dataMC = false, drawStatBox = true, save = 0 +// +// For plotting mean response and resolution as a function of +// particle momentum +// PlotMeanError(infilest, region, resol, save, debug) +// Defaults region = 3 (overall), resol = false (response), save = 0, +// debug = false +// Format of the input file: +// # of energy points, # of types, # of regions +// Then for each type, energy point +// Type, lower and higher edge of momentum +// Mean response and its error for the 4 regions +// Width of response and uts error for the 4 regions // // where: // infile (std::string) = Name of the input ROOT file @@ -134,11 +152,15 @@ // o>0 to carry out pol0 fit, o>1 to restrict // fit region between -20 & 20; d=1 to show grid; // h=0,1 to show plots with 2- or 1-Gaussian fit +// ieta (int) = specific ieta histogram to be plotted; if 0 +// histograms for all ieta's from -numb/2 to numb/2 +// will be plotted // lumi (double) = Integrated luminosity of the dataset used which // needs to be drawn on the top of the canvas // along with CM energy (if lumi > 0) // ener (double) = CM energy of the dataset used -// save (bool) = if true it saves the canvas as a pdf file +// save (int) = if > 0 it saves the canvas as a pdf file; or +// if < 0 it saves the canvas as a C file // normalize(bool) = if the histograms to be scaled to get // normalization to 1 // prefixF (string) = string to be included to the pad name @@ -156,28 +178,38 @@ // and 1..conds for the variations) // conds (int) = number of variations in estimating systematic // checks +// infilest (string) = input file name containing the responses and +// resolutions for barrel, transition, endcap, +// overall regions at 5 energies using 3 methods +// region (int) = region to be selected: 0 = barrel, 1 = transition, +// 2 = endcap, 3 = overall (3) +// resol (bool) = parameter to be plotted: true = resolution, +// false = response (false) ////////////////////////////////////////////////////////////////////////////// -#include +#include #include -#include -#include -#include -#include #include +#include +#include #include #include -#include -#include +#include #include +#include +#include +#include +#include #include #include -#include -#include +#include +#include +#include +#include #include #include -#include -#include +#include +#include #include "CalibCorr.C" @@ -947,27 +979,14 @@ void PlotHist(const char* infile, double ener = 13.0, bool dataMC = false, bool drawStatBox = true, - bool save = false) { + int save = 0) { std::string name0[6] = {"ratio00", "ratio10", "ratio20", "ratio30", "ratio40", "ratio50"}; std::string name1[5] = {"Z0", "Z1", "Z2", "Z3", "Z4"}; std::string name2[5] = {"L0", "L1", "L2", "L3", "L4"}; std::string name3[5] = {"V0", "V1", "V2", "V3", "V4"}; - std::string name4[16] = {"etaB31", - "etaB32", - "etaB33", - "etaB34", - "etaB21", - "etaB22", - "etaB23", - "etaB24", - "etaB11", - "etaB12", - "etaB13", - "etaB14", - "etaB01", - "etaB02", - "etaB03", - "etaB04"}; + std::string name4[20] = {"etaB41", "etaB42", "etaB43", "etaB44", "etaB31", "etaB32", "etaB33", + "etaB34", "etaB21", "etaB22", "etaB23", "etaB24", "etaB11", "etaB12", + "etaB13", "etaB14", "etaB01", "etaB02", "etaB03", "etaB04"}; std::string name5[5] = {"W0", "W1", "W2", "W3", "W4"}; std::string title[6] = {"Tracks with p = 10:20 GeV", "Tracks with p = 20:30 GeV", @@ -975,22 +994,16 @@ void PlotHist(const char* infile, "Tracks with p = 40:60 GeV", "Tracks with p = 60:100 GeV", "Tracks with p = 20:100 GeV"}; - std::string title1[16] = {"Tracks with p = 40:60 GeV (Barrel)", - "Tracks with p = 40:60 GeV (Transition)", - "Tracks with p = 40:60 GeV (Endcap)", - "Tracks with p = 40:60 GeV", - "Tracks with p = 30:40 GeV (Barrel)", - "Tracks with p = 30:40 GeV (Transition)", - "Tracks with p = 30:40 GeV (Endcap)", - "Tracks with p = 30:40 GeV", - "Tracks with p = 20:30 GeV (Barrel)", - "Tracks with p = 20:30 GeV (Transition)", - "Tracks with p = 20:30 GeV (Endcap)", - "Tracks with p = 20:30 GeV", - "Tracks with p = 10:20 GeV (Barrel)", - "Tracks with p = 10:20 GeV (Transition)", - "Tracks with p = 10:20 GeV (Endcap)", - "Tracks with p = 10:20 GeV"}; + std::string title1[20] = {"Tracks with p = 60:100 GeV (Barrel)", "Tracks with p = 60:100 GeV (Transition)", + "Tracks with p = 60:100 GeV (Endcap)", "Tracks with p = 60:100 GeV", + "Tracks with p = 40:60 GeV (Barrel)", "Tracks with p = 40:60 GeV (Transition)", + "Tracks with p = 40:60 GeV (Endcap)", "Tracks with p = 40:60 GeV", + "Tracks with p = 30:40 GeV (Barrel)", "Tracks with p = 30:40 GeV (Transition)", + "Tracks with p = 30:40 GeV (Endcap)", "Tracks with p = 30:40 GeV", + "Tracks with p = 20:30 GeV (Barrel)", "Tracks with p = 20:30 GeV (Transition)", + "Tracks with p = 20:30 GeV (Endcap)", "Tracks with p = 20:30 GeV", + "Tracks with p = 10:20 GeV (Barrel)", "Tracks with p = 10:20 GeV (Transition)", + "Tracks with p = 10:20 GeV (Endcap)", "Tracks with p = 10:20 GeV"}; std::string xtitl[5] = {"E_{HCAL}/(p-E_{ECAL})", "i#eta", "d_{L1}", "# Vertex", "E_{HCAL}/(p-E_{ECAL})"}; std::string ytitl[5] = { "Tracks", "MPV(E_{HCAL}/(p-E_{ECAL}))", "MPV(E_{HCAL}/(p-E_{ECAL}))", "MPV(E_{HCAL}/(p-E_{ECAL}))", "Tracks"}; @@ -1015,7 +1028,7 @@ void PlotHist(const char* infile, TFile* file = new TFile(infile); TLine* line(0); char name[100], namep[100]; - int kmax = (mode == 4) ? 16 : (((mode < 1) && (mode > 5)) ? 6 : 5); + int kmax = (mode == 4) ? 20 : (((mode < 1) && (mode > 5)) ? 6 : 5); for (int k = 0; k < kmax; ++k) { if (mode == 1) { sprintf(name, "%s%s", prefix.c_str(), name1[k].c_str()); @@ -1156,15 +1169,133 @@ void PlotHist(const char* infile, txt2->Draw("same"); pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { + sprintf(name, "%s.pdf", pad->GetName()); + pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); + } + } + } +} + +void PlotHistEta(const char* infile, + std::string prefix, + std::string text, + int iene = 3, + int numb = 50, + int ieta = 0, + double lumi = 0, + double ener = 13.0, + bool dataMC = false, + bool drawStatBox = true, + int save = 0) { + std::string name0 = "ratio"; + std::string title[5] = {"10:20", "20:30", "30:40", "40:60", "60:100"}; + std::string xtitl = "E_{HCAL}/(p-E_{ECAL})"; + std::string ytitl = "Tracks"; + + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); + if (drawStatBox) { + int iopt(1110); + gStyle->SetOptStat(iopt); + gStyle->SetOptFit(1); + } else { + gStyle->SetOptStat(0); + gStyle->SetOptFit(0); + } + if (iene < 0 || iene >= 5) + iene = 3; + int numb2 = numb / 2; + if (ieta < -numb2 || ieta > numb2) + ieta = 0; + int ietaMin = ((ieta == 0) ? 1 : ((ieta > 0) ? (numb2 + ieta) : (numb2 + ieta + 1))); + int ietaMax = (ieta == 0) ? numb : ietaMin; + TFile* file = new TFile(infile); + char name[100], namep[100]; + for (int k = ietaMin; k <= ietaMax; ++k) { + int eta = (k > numb2) ? (k - numb2) : (k - numb2 - 1); + sprintf(name, "%s%s%d%d", prefix.c_str(), name0.c_str(), iene, k); + TH1D* hist1 = (TH1D*)file->FindObjectAny(name); + if (hist1 != nullptr) { + TH1D* hist = (TH1D*)(hist1->Clone()); + double ymin(0.90); + sprintf(namep, "c_%s", name); + TCanvas* pad = new TCanvas(namep, namep, 700, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + hist->GetXaxis()->SetTitleSize(0.04); + hist->GetXaxis()->SetTitle(xtitl.c_str()); + hist->GetYaxis()->SetTitle(ytitl.c_str()); + hist->GetYaxis()->SetLabelOffset(0.005); + hist->GetYaxis()->SetTitleSize(0.04); + hist->GetYaxis()->SetLabelSize(0.035); + hist->GetYaxis()->SetTitleOffset(1.10); + hist->GetXaxis()->SetRangeUser(0.25, 2.25); + hist->SetMarkerStyle(20); + hist->SetMarkerColor(2); + hist->SetLineColor(2); + hist->Draw(); + pad->Update(); + TPaveStats* st1 = (TPaveStats*)hist->GetListOfFunctions()->FindObject("stats"); + if (st1 != nullptr) { + ymin = 0.70; + st1->SetY1NDC(ymin); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + double ymx(0.96), xmi(0.25), xmx(0.90); + char txt[100]; + if (lumi > 0.1) { + ymx = ymin - 0.005; + xmi = 0.45; + TPaveText* txt0 = new TPaveText(0.65, 0.91, 0.90, 0.96, "blNDC"); + txt0->SetFillColor(0); + sprintf(txt, "%4.1f TeV %5.1f fb^{-1}", ener, lumi); + txt0->AddText(txt); + txt0->Draw("same"); + } + double ymi = ymx - 0.05; + TPaveText* txt1 = new TPaveText(xmi, ymi, xmx, ymx, "blNDC"); + txt1->SetFillColor(0); + if (text == "") { + sprintf(txt, "Tracks with p = %s GeV at i#eta = %d", title[iene].c_str(), eta); + } else { + sprintf(txt, "Tracks with p = %s GeV at i#eta = %d (%s)", title[iene].c_str(), eta, text.c_str()); + } + txt1->AddText(txt); + txt1->Draw("same"); + double xmax = (dataMC) ? 0.33 : 0.44; + ymi = (lumi > 0.1) ? 0.91 : 0.84; + ymx = ymi + 0.05; + TPaveText* txt2 = new TPaveText(0.11, ymi, xmax, ymx, "blNDC"); + txt2->SetFillColor(0); + if (dataMC) + sprintf(txt, "CMS Preliminary"); + else + sprintf(txt, "CMS Simulation Preliminary"); + txt2->AddText(txt); + txt2->Draw("same"); + pad->Modified(); + pad->Update(); + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } } -void PlotHists(std::string infile, std::string prefix, std::string text, bool drawStatBox = true, bool save = false) { +void PlotHists(std::string infile, std::string prefix, std::string text, bool drawStatBox = true, int save = 0) { int colors[6] = {1, 6, 4, 7, 2, 9}; std::string types[6] = {"B", "C", "D", "E", "F", "G"}; std::string names[3] = {"ratio20", "Z2", "W2"}; @@ -1273,9 +1404,12 @@ void PlotHists(std::string infile, std::string prefix, std::string text, bool dr } pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -1292,7 +1426,7 @@ void PlotTwoHists(std::string infile, double lumi = 0, double ener = 13.0, int drawStatBox = 0, - bool save = false) { + int save = 0) { int colors[2] = {2, 4}; int numb[2] = {5, 1}; std::string names0[5] = {"ratio00", "ratio00One", "etaB04One", "Z0", "W0"}; @@ -1458,9 +1592,12 @@ void PlotTwoHists(std::string infile, pad->Update(); } pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -1473,7 +1610,7 @@ void PlotFiveHists(std::string infile, int iname = 3, int drawStatBox = 0, bool normalize = false, - bool save = false, + int save = 0, std::string prefix1 = "", std::string text1 = "", std::string prefix2 = "", @@ -1676,15 +1813,18 @@ void PlotFiveHists(std::string infile, pad->Update(); } pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } } -void PlotHistCorrResults(std::string infile, std::string text, std::string prefixF, bool save = false) { +void PlotHistCorrResults(std::string infile, std::string text, std::string prefixF, int save = 0) { std::string name[5] = {"Eta1Bf", "Eta2Bf", "Eta1Af", "Eta2Af", "Cvg0"}; std::string title[5] = {"Mean at the start of itertions", "Median at the start of itertions", @@ -1753,9 +1893,12 @@ void PlotHistCorrResults(std::string infile, std::string text, std::string prefi txt1->Draw("same"); pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(namep, "%s.pdf", pad->GetName()); pad->Print(namep); + } else if (save < 0) { + sprintf(namep, "%s.C", pad->GetName()); + pad->Print(namep); } } } @@ -1768,7 +1911,7 @@ void PlotHistCorrFactor(char* infile, int nmin = 100, bool dataMC = false, bool drawStatBox = true, - bool save = false) { + int save = 0) { std::map cfacs; int etamin(100), etamax(-100), maxdepth(0); readCorrFactors(infile, scale, cfacs, etamin, etamax, maxdepth); @@ -1882,13 +2025,16 @@ void PlotHistCorrFactor(char* infile, txt2->Draw("same"); pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } -void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF = "", bool save = false) { +void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF = "", int save = 0) { std::map cfacs; int etamin(100), etamax(-100), maxdepth(0); double scale(1.0); @@ -1972,9 +2118,12 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF = line->Draw("same"); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } @@ -1994,7 +2143,7 @@ void PlotHistCorrFactors(char* infile1, int nmin = 100, bool dataMC = false, int year = 2018, - bool save = false) { + int save = 0) { std::map cfacs[5]; std::vector texts; int nfile(0), etamin(100), etamax(-100), maxdepth(0); @@ -2201,14 +2350,17 @@ void PlotHistCorrFactors(char* infile1, line->Draw("same"); pad->Update(); } - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } -void PlotHistCorrSys(std::string infilec, int conds, std::string text, bool save = false) { +void PlotHistCorrSys(std::string infilec, int conds, std::string text, int save = 0) { char fname[100]; sprintf(fname, "%s_cond0.txt", infilec.c_str()); int etamin(100), etamax(-100), maxdepth(0); @@ -2314,14 +2466,17 @@ void PlotHistCorrSys(std::string infilec, int conds, std::string text, bool save } legend->Draw("same"); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } -void PlotHistCorrLumis(std::string infilec, int conds, double lumi, bool save = false) { +void PlotHistCorrLumis(std::string infilec, int conds, double lumi, int save = 0) { char fname[100]; sprintf(fname, "%s_0.txt", infilec.c_str()); std::map cfacs; @@ -2393,14 +2548,17 @@ void PlotHistCorrLumis(std::string infilec, int conds, double lumi, bool save = } legend->Draw("same"); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } -void PlotHistCorrRel(char* infile1, char* infile2, std::string text1, std::string text2, bool save = false) { +void PlotHistCorrRel(char* infile1, char* infile2, std::string text1, std::string text2, int save = 0) { std::map cfacs1, cfacs2; int etamin(100), etamax(-100), maxdepth(0); readCorrFactors(infile1, 1.0, cfacs1, etamin, etamax, maxdepth); @@ -2509,9 +2667,12 @@ void PlotHistCorrRel(char* infile1, char* infile2, std::string text1, std::strin } legend->Draw("same"); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -2521,7 +2682,7 @@ void PlotFourHists(std::string infile, int type = 0, int drawStatBox = 0, bool normalize = false, - bool save = false, + int save = 0, std::string prefix1 = "", std::string text1 = "", std::string prefix2 = "", @@ -2648,9 +2809,12 @@ void PlotFourHists(std::string infile, */ pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -2659,7 +2823,7 @@ void PlotPUCorrHists(std::string infile = "corrfac.root", std::string prefix = "", int drawStatBox = 0, bool approve = true, - bool save = false) { + int save = 0) { std::string name1[4] = {"W0", "W1", "W2", "P"}; std::string name2[4] = {"All", "Barrel", "Endcap", ""}; std::string name3[2] = {"", "p = 40:60 GeV"}; @@ -2755,9 +2919,12 @@ void PlotPUCorrHists(std::string infile = "corrfac.root", } pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -2772,7 +2939,7 @@ void PlotHistCorr(const char* infile, int eta = 0, int mode = 1, bool drawStatBox = true, - bool save = false) { + int save = 0) { gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); gStyle->SetPadColor(kWhite); @@ -2854,9 +3021,12 @@ void PlotHistCorr(const char* infile, txt1->Draw("same"); pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -2869,7 +3039,7 @@ void PlotPropertyHist(const char* infile, double ener = 13.0, bool dataMC = false, bool drawStatBox = true, - bool save = false) { + int save = 0) { std::string name0[3] = {"energyE2", "energyH2", "energyP2"}; std::string title0[3] = {"Energy in ECAL", "Energy in HCAL", "Track Momentum"}; std::string xtitl0[3] = {"Energy (GeV)", "Energy (GeV)", "p (GeV)"}; @@ -2964,9 +3134,12 @@ void PlotPropertyHist(const char* infile, txt2->Draw("same"); pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } @@ -3050,11 +3223,146 @@ void PlotPropertyHist(const char* infile, txt2->Draw("same"); pad->Modified(); pad->Update(); - if (save) { + if (save > 0) { sprintf(name, "%s.pdf", pad->GetName()); pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); } } } } } + +void PlotMeanError(const std::string infilest, int reg = 3, bool resol = false, int save = 0, bool debug = false) { + bool ok(false); + const int ntypmx = 3; + const int nregmx = 4; + if (reg < 0 || reg >= nregmx) + reg = nregmx - 1; + int nEner(0), nType(0), nPts(0); + std::vector energy[ntypmx], denergy[ntypmx], value[ntypmx], dvalue[ntypmx]; + // First read the data + std::ifstream fInput(infilest.c_str()); + if (!fInput.good()) { + std::cout << "Cannot open file " << infilest << std::endl; + } else { + ok = true; + fInput >> nEner >> nType >> nPts; + int nmax = nEner * nType; + int type, elow, ehigh; + double v1[4], e1[4], v2[4], e2[4]; + for (int n = 0; n < nmax; ++n) { + fInput >> type >> elow >> ehigh; + fInput >> v1[0] >> e1[0] >> v1[1] >> e1[1] >> v1[2] >> e1[2] >> v1[3] >> e1[3]; + fInput >> v2[0] >> e2[0] >> v2[1] >> e2[1] >> v2[2] >> e2[2] >> v2[3] >> e2[3]; + double ener = 0.5 * (ehigh + elow); + double dene = 0.5 * (ehigh - elow); + energy[type].push_back(ener); + denergy[type].push_back(dene); + if (resol) { + value[type].push_back(v2[reg]); + dvalue[type].push_back(e2[reg]); + } else { + value[type].push_back(v1[reg]); + dvalue[type].push_back(e1[reg]); + } + } + fInput.close(); + std::cout << "Reads " << (nmax + 1) << " cards from " << infilest << " with measurements for " << nEner + << " energies and " << nType << " types" << std::endl; + if (debug) { + for (int n = 0; n < nType; ++n) { + std::cout << "Type " << n << " with " << energy[n].size() << " points\n"; + for (unsigned int k = 0; k < energy[n].size(); ++k) + std::cout << " [" << k << "] " << energy[n][k] << " +- " << denergy[n][k] << " Value " << value[n][k] + << " +- " << dvalue[n][k] << std::endl; + } + } + } + + // Now the plots + if (ok) { + int mvsres = (resol) ? 1 : 0; + std::string names[2] = {"Mean", "Resol"}; + std::string namet[nregmx] = {"Barrel", "Transition", "Endcap", "Combined"}; + char cname[100]; + sprintf(cname, "c_%s%s", names[mvsres].c_str(), namet[reg].c_str()); + int color[ntypmx] = {2, 4, 1}; + int mtype[ntypmx] = {20, 21, 22}; + double ymin[2] = {0.65, 0.10}; + double ymax[2] = {1.30, 0.50}; + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(kFALSE); + gStyle->SetPadBorderMode(0); + gStyle->SetCanvasBorderMode(0); + gStyle->SetOptStat(0); + TCanvas* canvas = new TCanvas(cname, cname, 500, 500); + canvas->SetTopMargin(0.05); + canvas->SetBottomMargin(0.14); + canvas->SetLeftMargin(0.15); + canvas->SetRightMargin(0.10); + TH1F* vFrame = canvas->DrawFrame(0.0, ymin[mvsres], 120.0, ymax[mvsres]); + vFrame->GetXaxis()->SetRangeUser(0.0, 120.0); + vFrame->GetYaxis()->SetRangeUser(ymin[mvsres], ymax[mvsres]); + vFrame->GetXaxis()->SetLabelSize(0.04); + vFrame->GetYaxis()->SetLabelSize(0.04); + vFrame->GetXaxis()->SetTitleSize(0.04); + vFrame->GetYaxis()->SetTitleSize(0.04); + vFrame->GetXaxis()->SetTitleOffset(1.2); + vFrame->GetYaxis()->SetTitleOffset(1.6); + vFrame->GetXaxis()->SetLabelOffset(0.0); + vFrame->GetXaxis()->SetTitle("p_{Beam} (GeV/c)"); + if (resol) { + vFrame->GetYaxis()->SetTitle("Width(E_{HCAL}/(p-E_{ECAL}))"); + } else { + vFrame->GetYaxis()->SetTitle("MPV(E_{HCAL}/(p-E_{ECAL}))"); + } + TLegend* legend = new TLegend(0.70, 0.80, 0.90, 0.94); + legend->SetFillColor(kWhite); + std::string nameg[ntypmx] = {"MAHI", "M0", "M2"}; + for (int n = 0; n < nType; ++n) { + unsigned int nmax0 = energy[n].size(); + double mom[nmax0], dmom[nmax0], mean[nmax0], dmean[nmax0]; + for (unsigned int k = 0; k < nmax0; ++k) { + mom[k] = energy[n][k]; + dmom[k] = denergy[n][k]; + mean[k] = value[n][k]; + dmean[k] = dvalue[n][k]; + } + TGraphErrors* graph = new TGraphErrors(nmax0, mom, mean, dmom, dmean); + graph->SetMarkerStyle(mtype[n]); + graph->SetMarkerColor(color[n]); + graph->SetMarkerSize(1.4); + graph->SetLineColor(color[n]); + graph->SetLineWidth(2); + sprintf(cname, "%s", nameg[n].c_str()); + legend->AddEntry(graph, cname, "lp"); + graph->Draw("P"); + } + legend->Draw("same"); + std::string regions[nregmx] = {"20118B Barrel", "2018B Transition", "2018B Endcap", "2018B"}; + sprintf(cname, "%s", regions[reg].c_str()); + TPaveText* txt0 = new TPaveText(0.16, 0.90, 0.40, 0.94, "blNDC"); + txt0->SetFillColor(0); + txt0->AddText(cname); + txt0->Draw("same"); + TPaveText* txt1 = new TPaveText(0.15, 0.95, 0.40, 0.99, "blNDC"); + txt1->SetFillColor(0); + sprintf(cname, "CMS Preliminary"); + txt1->AddText(cname); + txt1->Draw("same"); + canvas->Update(); + if (save > 0) { + sprintf(cname, "%s.pdf", canvas->GetName()); + canvas->Print(cname); + } else if (save < 0) { + sprintf(cname, "%s.C", canvas->GetName()); + canvas->Print(cname); + } + } +} diff --git a/Calibration/HcalCalibAlgos/macros/CalibMonitor.C b/Calibration/HcalCalibAlgos/macros/CalibMonitor.C index f5f5fbaf0085b..48fc9f819346b 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibMonitor.C +++ b/Calibration/HcalCalibAlgos/macros/CalibMonitor.C @@ -618,12 +618,12 @@ void CalibMonitor::Init(TChain *tree, const char *dupFileName, const char *comFi for (int i = 0; i < 4; ++i) ietas_.push_back(ietas[i]); int nxbin(100); - double xlow(0.25), xhigh(5.25); + double xlow(0.0), xhigh(5.0); if (coarseBin_ == 1) { + xlow = 0.25; + xhigh = 5.25; nxbin = 50; } else if (coarseBin_ > 1) { - xlow = 0.0; - xhigh = 5.0; if (coarseBin_ == 2) nxbin = 500; else @@ -1242,7 +1242,7 @@ void CalibMonitor::Loop() { fileout_.close(); std::cout << "Writes " << good << " events in the file " << outFileName_ << std::endl; } - std::cout << "Finds " << duplicate << " Duplicate events out of " << kount << " evnts in this file with p>20 Gev" + std::cout << "Finds " << duplicate << " Duplicate events out of " << kount << " evnts in this file with p>10 Gev" << std::endl; std::cout << "Number of selected events:" << std::endl; for (unsigned int k = 1; k < ps_.size(); ++k) diff --git a/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C b/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C index 313f185be47f8..ec16398c0f7ab 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C +++ b/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C @@ -7,12 +7,15 @@ // phimin, phimax, zside, nvxlo, nvxhi, rbx, exclude, // etamax); // c1.Loop(); -// c1.savePlot(histFileName,append,all,debug); +// c1.savePlot(histFileName, append, all, debug); // // This will prepare a set of histograms with properties of the tracks // which can be displayed by the method in this file // -// PlotHist(histFileName, prefix, flagC, etalo, etahi, save) +// PlotHist(histFileName, prefix, text, flagC, etalo, etahi, save) +// +// This will plot the heistograms and save the canvases +// // // where: // @@ -85,6 +88,7 @@ // all (bool) = true/false if all histograms to be saved or // not (def false) // +// text (string) = string to be put in the title // flagC (int) = 3 digit integer (hdo) with control // information (h=0/1 for plottting the depth // depedendent histograms; @@ -291,6 +295,7 @@ private: std::vector h_etaEH[CalibPlots::npbin0]; std::vector h_etaEp[CalibPlots::npbin0]; std::vector h_etaEE[CalibPlots::npbin0]; + std::vector h_etaEE0[CalibPlots::npbin0]; std::vector h_mom, h_eEcal, h_eHcal; std::vector h_bvlist, h_bvlist2, h_evlist, h_evlist2; std::vector h_bvlist3, h_evlist3; @@ -626,6 +631,10 @@ void CalibPlotProperties::Init(TChain *tree, const char *dupFileName) { h_etaEE[k].push_back(new TH1D(name, title, 100, 0, 10)); kk = h_etaEE[k].size() - 1; h_etaEE[k][kk]->Sumw2(); + sprintf(name, "%senergyER%d%d", prefix_.c_str(), k, j); + h_etaEE0[k].push_back(new TH1D(name, title, 100, 0, 1)); + kk = h_etaEE0[k].size() - 1; + h_etaEE0[k][kk]->Sumw2(); } } @@ -906,6 +915,8 @@ void CalibPlotProperties::Loop(Long64_t nentries) { h_etaEp[kp][jp2]->Fill(pmom, t_EventWeight); h_etaEE[kp][jp1]->Fill(t_eMipDR, t_EventWeight); h_etaEE[kp][jp2]->Fill(t_eMipDR, t_EventWeight); + h_etaEE0[kp][jp1]->Fill(t_eMipDR, t_EventWeight); + h_etaEE0[kp][jp2]->Fill(t_eMipDR, t_EventWeight); } if (kp == kp50) { if (je1 != CalibPlots::netabin) { @@ -1092,6 +1103,10 @@ void CalibPlotProperties::savePlot(const std::string &theName, bool append, bool TH1D *hist = (TH1D *)h_etaEE[k][j]->Clone(); hist->Write(); } + if (h_etaEE0[k].size() > j && h_etaEE0[k][j] != nullptr && (all || (k == kp50))) { + TH1D *hist = (TH1D *)h_etaEE0[k][j]->Clone(); + hist->Write(); + } } } @@ -1164,7 +1179,7 @@ void CalibPlotProperties::correctEnergy(double &eHcal) { } } -void PlotThisHist(TH1D *hist, int save) { +void PlotThisHist(TH1D *hist, const std::string &text, int save) { char namep[120]; sprintf(namep, "c_%s", hist->GetName()); TCanvas *pad = new TCanvas(namep, namep, 700, 500); @@ -1183,6 +1198,17 @@ void PlotThisHist(TH1D *hist, int save) { pad->Modified(); pad->Update(); TPaveStats *st1 = (TPaveStats *)hist->GetListOfFunctions()->FindObject("stats"); + TPaveText *txt0 = new TPaveText(0.12, 0.91, 0.49, 0.96, "blNDC"); + txt0->SetFillColor(0); + char txt[100]; + sprintf(txt, "CMS Simulation Preliminary"); + txt0->AddText(txt); + txt0->Draw("same"); + TPaveText *txt1 = new TPaveText(0.51, 0.91, 0.90, 0.96, "blNDC"); + txt1->SetFillColor(0); + sprintf(txt, "%s", text.c_str()); + txt1->AddText(txt); + txt1->Draw("same"); if (st1 != nullptr) { st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); @@ -1201,6 +1227,7 @@ void PlotThisHist(TH1D *hist, int save) { void PlotHist(const char *hisFileName, const std::string &prefix = "", + const std::string &text = "", int flagC = 111, int etalo = 0, int etahi = 30, @@ -1227,14 +1254,14 @@ void PlotHist(const char *hisFileName, if (hist != nullptr) { sprintf(title, "Momentum for %s (GeV)", CalibPlots::getTitle(k).c_str()); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%seta%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "#eta for %s", CalibPlots::getTitle(k).c_str()); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } } for (int k = 0; k < CalibPlots::npbin; ++k) { @@ -1247,7 +1274,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%seta1%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1258,7 +1285,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%seta2%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1269,7 +1296,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%seta3%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1280,7 +1307,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%seta4%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1291,21 +1318,21 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%sdl1%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "Distance from L1 (p = %d:%d GeV)", CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%svtx%d", prefix.c_str(), k); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "N_{Vertex} (p = %d:%d GeV)", CalibPlots::getP(k), CalibPlots::getP(k + 1)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } } } @@ -1333,7 +1360,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k + 1), j); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%senergyP%d%d", prefix.c_str(), k, j); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1354,7 +1381,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k + 1), j); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%senergyE%d%d", prefix.c_str(), k, j); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1375,7 +1402,13 @@ void PlotHist(const char *hisFileName, CalibPlots::getP(k + 1), j); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); + } + sprintf(name, "%senergyER%d%d", prefix.c_str(), k, j); + hist = (TH1D *)(file->FindObjectAny(name)); + if (hist != nullptr) { + std::cout << name << " Mean " << hist->GetMean() << " +- " << hist->GetMeanError() << " Entries " + << hist->GetEntries() << " RMS " << hist->GetRMS() << std::endl; } } } @@ -1393,7 +1426,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getEta(j - 1), CalibPlots::getEta(j)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%senergyP%d", prefix.c_str(), j); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1407,7 +1440,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getEta(j - 1), CalibPlots::getEta(j)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "%senergyE%d", prefix.c_str(), j); hist = (TH1D *)(file->FindObjectAny(name)); @@ -1421,7 +1454,7 @@ void PlotHist(const char *hisFileName, CalibPlots::getEta(j - 1), CalibPlots::getEta(j)); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } } } @@ -1430,7 +1463,7 @@ void PlotHist(const char *hisFileName, hist = (TH1D *)(file->FindObjectAny("hnvtx")); if (hist != nullptr) { hist->GetXaxis()->SetTitle("Number of vertices"); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } for (int i = 0; i < CalibPlots::ndepth; i++) { sprintf(name, "b_edepth%d", i); @@ -1438,42 +1471,42 @@ void PlotHist(const char *hisFileName, if (hist != nullptr) { sprintf(title, "Total RecHit energy in depth %d (Barrel)", i + 1); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "b_recedepth%d", i); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "RecHit energy in depth %d (Barrel)", i + 1); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "b_nrecdepth%d", i); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "#RecHits in depth %d (Barrel)", i + 1); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "e_edepth%d", i); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "Total RecHit energy in depth %d (Endcap)", i + 1); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "e_recedepth%d", i); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "RecHit energy in depth %d (Endcap)", i + 1); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } sprintf(name, "e_nrecdepth%d", i); hist = (TH1D *)(file->FindObjectAny(name)); if (hist != nullptr) { sprintf(title, "#RecHits in depth %d (Endcap)", i + 1); hist->GetXaxis()->SetTitle(title); - PlotThisHist(hist, save); + PlotThisHist(hist, text, save); } } TH2F *h_etaE = (TH2F *)(file->FindObjectAny("heta")); diff --git a/Calibration/HcalCalibAlgos/macros/CalibTree.C b/Calibration/HcalCalibAlgos/macros/CalibTree.C index 74b43c7e6356f..a24e186e3347c 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibTree.C +++ b/Calibration/HcalCalibAlgos/macros/CalibTree.C @@ -42,7 +42,7 @@ // -1 loose, -2 flexible, > 0 for systematic // puCorr (int) = PU correction to be applied or not: 0 no // correction; < 0 use eDelta; > 0 rho dependent -// correction (-2) +// correction (-5: 2018 version) // applyL1Cut (int) = Flag to see if closeness to L1 object to be // applied: 0 no check; 1 only to events with // datatype not equal to 1; 2 to all (1) @@ -124,7 +124,7 @@ void Run(const char *inFileName = "Silver.root", int ietaMax = 25, int ietaTrack = -1, int sysmode = -1, - int puCorr = -2, + int puCorr = -5, int applyL1Cut = 1, double l1Cut = 0.5, int truncateFlag = 0, @@ -339,7 +339,7 @@ void doIt(const char *infile, const char *dup) { 25, -1, -1, - -2, + -5, 1, 0.5, 0, diff --git a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc index c1ef9912fe9d4..bc32ef3278ee6 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc @@ -849,7 +849,7 @@ void HcalIsoTrkAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("maxInMiss", 0); desc.add("maxOutMiss", 0); // Minimum momentum of selected isolated track and signal zone - desc.add("minimumTrackP", 20.0); + desc.add("minimumTrackP", 10.0); desc.add("coneRadius", 34.98); // signal zone in ECAL and MIP energy cutoff desc.add("coneRadiusMIP", 14.0); diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc index 69d6b099b6a26..4a99a8f88e8a0 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc @@ -83,7 +83,7 @@ #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" -//#define EDM_ML_DEBUG +#define EDM_ML_DEBUG class HcalIsoTrackStudy : public edm::one::EDAnalyzer { public: @@ -141,6 +141,7 @@ class HcalIsoTrackStudy : public edm::one::EDAnalyzer& trkDirs, double dR); + double eThreshold(const DetId& id, double eta) const; l1t::L1TGlobalUtil* l1GtUtils_; edm::Service fs; @@ -155,7 +156,7 @@ class HcalIsoTrackStudy : public edm::one::EDAnalyzer tok_ew_; edm::EDGetTokenT> tok_alg_; - edm::ESGetToken tok_ddrec_; - edm::ESGetToken tok_bFieldH_; - edm::ESGetToken tok_ecalChStatus_; - edm::ESGetToken tok_sevlv_; - edm::ESGetToken tok_geom_; - edm::ESGetToken tok_caloTopology_; - edm::ESGetToken tok_htopo_; - edm::ESGetToken tok_resp_; - TTree *tree, *tree2; unsigned int t_RunNo, t_EventNo; int t_Run, t_Event, t_DataType, t_ieta, t_iphi; @@ -242,6 +234,7 @@ HcalIsoTrackStudy::HcalIsoTrackStudy(const edm::ParameterSet& iConfig) prescaleHigh_(iConfig.getParameter("prescaleHigh")), useRaw_(iConfig.getUntrackedParameter("useRaw", 0)), dataType_(iConfig.getUntrackedParameter("dataType", 0)), + mode_(iConfig.getUntrackedParameter("outMode", 11)), ignoreTrigger_(iConfig.getUntrackedParameter("ignoreTriggers", false)), useL1Trigger_(iConfig.getUntrackedParameter("useL1Trigger", false)), unCorrect_(iConfig.getUntrackedParameter("unCorrect", false)), @@ -299,7 +292,7 @@ HcalIsoTrackStudy::HcalIsoTrackStudy(const edm::ParameterSet& iConfig) std::string prdnam = iConfig.getUntrackedParameter("producerName", ""); edm::InputTag algTag = iConfig.getParameter("algInputTag"); edm::InputTag extTag = iConfig.getParameter("extInputTag"); - l1GtUtils_ = new l1t::L1TGlobalUtil(iConfig, consumesCollector(), *this, algTag, extTag, l1t::UseEventSetupIn::Event); + l1GtUtils_ = new l1t::L1TGlobalUtil(iConfig, consumesCollector(), *this, algTag, extTag); // define tokens for access tok_trigEvt_ = consumes(triggerEvent_); tok_trigRes_ = consumes(theTriggerResultsLabel_); @@ -332,38 +325,33 @@ HcalIsoTrackStudy::HcalIsoTrackStudy(const edm::ParameterSet& iConfig) << edm::InputTag(modnam, labelHBHE_, prdnam) << " " << labelTower_; } - edm::LogVerbatim("HcalIsoTrack") - << "Parameters read from config file \n" - << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality " << theTrackQuality_ << "\t minQuality " - << selectionParameter_.minQuality << "\t maxDxyPV " << selectionParameter_.maxDxyPV << "\t maxDzPV " - << selectionParameter_.maxDzPV << "\t maxChi2 " << selectionParameter_.maxChi2 << "\t maxDpOverP " - << selectionParameter_.maxDpOverP << "\t minOuterHit " << selectionParameter_.minOuterHit << "\t minLayerCrossed " - << selectionParameter_.minLayerCrossed << "\t maxInMiss " << selectionParameter_.maxInMiss << "\t maxOutMiss " - << selectionParameter_.maxOutMiss << "\t a_coneR " << a_coneR_ << ":" << a_coneR1_ << ":" << a_coneR2_ - << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR " << a_mipR_ << "\n pTrackMin_ " << pTrackMin_ << "\t eEcalMax_ " - << eEcalMax_ << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ " << slopeRestrictionP_ - << "\t eIsolateStrong_ " << eIsolate1_ << "\t eIsolateSoft_ " << eIsolate2_ << "\t hcalScale_ " << hcalScale_ - << "\n\t momentumLow_ " << pTrackLow_ << "\t prescaleLow_ " << prescaleLow_ << "\t momentumHigh_ " << pTrackHigh_ - << "\t prescaleHigh_ " << prescaleHigh_ << "\n\t useRaw_ " << useRaw_ << "\t ignoreTrigger_ " << ignoreTrigger_ - << "\n\t useL1Trigegr_ " << useL1Trigger_ << "\t dataType_ " << dataType_ << "\t unCorrect_ " - << unCorrect_ << "\t collapseDepth_ " << collapseDepth_ << "\t L1TrigName_ " << l1TrigName_ - << "\nThreshold for EB " << hitEthrEB_ << " EE " << hitEthrEE0_ << ":" << hitEthrEE1_ << ":" << hitEthrEE2_ << ":" - << hitEthrEE3_ << ":" << hitEthrEELo_ << ":" << hitEthrEEHi_; + edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n" + << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality " + << theTrackQuality_ << "\t minQuality " << selectionParameter_.minQuality + << "\t maxDxyPV " << selectionParameter_.maxDxyPV << "\t maxDzPV " + << selectionParameter_.maxDzPV << "\t maxChi2 " << selectionParameter_.maxChi2 + << "\t maxDpOverP " << selectionParameter_.maxDpOverP << "\t minOuterHit " + << selectionParameter_.minOuterHit << "\t minLayerCrossed " + << selectionParameter_.minLayerCrossed << "\t maxInMiss " + << selectionParameter_.maxInMiss << "\t maxOutMiss " + << selectionParameter_.maxOutMiss << "\t a_coneR " << a_coneR_ << ":" << a_coneR1_ + << ":" << a_coneR2_ << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR " << a_mipR_ + << "\n pTrackMin_ " << pTrackMin_ << "\t eEcalMax_ " << eEcalMax_ + << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ " + << slopeRestrictionP_ << "\t eIsolateStrong_ " << eIsolate1_ << "\t eIsolateSoft_ " + << eIsolate2_ << "\t hcalScale_ " << hcalScale_ << "\n\t momentumLow_ " << pTrackLow_ + << "\t prescaleLow_ " << prescaleLow_ << "\t momentumHigh_ " << pTrackHigh_ + << "\t prescaleHigh_ " << prescaleHigh_ << "\n\t useRaw_ " << useRaw_ + << "\t ignoreTrigger_ " << ignoreTrigger_ << "\n\t useL1Trigegr_ " << useL1Trigger_ + << "\t dataType_ " << dataType_ << "\t mode_ " << mode_ + << "\t unCorrect_ " << unCorrect_ << "\t collapseDepth_ " << collapseDepth_ + << "\t L1TrigName_ " << l1TrigName_; edm::LogVerbatim("HcalIsoTrack") << "Process " << processName_ << " L1Filter:" << l1Filter_ << " L2Filter:" << l2Filter_ << " L3Filter:" << l3Filter_; for (unsigned int k = 0; k < trigNames_.size(); ++k) { edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k]; } - tok_ddrec_ = esConsumes(); - tok_bFieldH_ = esConsumes(); - tok_ecalChStatus_ = esConsumes(); - tok_sevlv_ = esConsumes(); - tok_geom_ = esConsumes(); - tok_caloTopology_ = esConsumes(); - tok_htopo_ = esConsumes(); - tok_resp_ = esConsumes(); - for (int i = 0; i < 10; i++) phibins_.push_back(-M_PI + 0.1 * (2 * i + 1) * M_PI); for (int i = 0; i < 8; ++i) @@ -394,16 +382,34 @@ void HcalIsoTrackStudy::analyze(edm::Event const& iEvent, edm::EventSetup const& << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); #endif //Get magnetic field and ECAL channel status - const MagneticField* bField = &iSetup.getData(tok_bFieldH_); - const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_ecalChStatus_); - const EcalSeverityLevelAlgo* theEcalSevlv = &iSetup.getData(tok_sevlv_); + edm::ESHandle bFieldH; + iSetup.get().get(bFieldH); + const MagneticField* bField = bFieldH.product(); + + edm::ESHandle ecalChStatus; + iSetup.get().get(ecalChStatus); + const EcalChannelStatus* theEcalChStatus = ecalChStatus.product(); + + edm::ESHandle sevlv; + iSetup.get().get(sevlv); + const EcalSeverityLevelAlgo* theEcalSevlv = sevlv.product(); // get handles to calogeometry and calotopology - const CaloGeometry* geo = &iSetup.getData(tok_geom_); - const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_); - const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo_); - const HcalRespCorrs resp = iSetup.getData(tok_resp_); - HcalRespCorrs* respCorrs = new HcalRespCorrs(resp); + edm::ESHandle pG; + iSetup.get().get(pG); + const CaloGeometry* geo = pG.product(); + + edm::ESHandle theCaloTopology; + iSetup.get().get(theCaloTopology); + const CaloTopology* caloTopology = theCaloTopology.product(); + + edm::ESHandle htopo; + iSetup.get().get(htopo); + const HcalTopology* theHBHETopology = htopo.product(); + + edm::ESHandle resp; + iSetup.get().get(resp); + HcalRespCorrs* respCorrs = new HcalRespCorrs(*resp.product()); respCorrs->setTopo(theHBHETopology); //=== genParticle information @@ -692,7 +698,7 @@ void HcalIsoTrackStudy::analyze(edm::Event const& iEvent, edm::EventSetup const& } void HcalIsoTrackStudy::beginJob() { - tree = fs->make("CalibTreeExtended", "CalibTreeExtended"); + tree = fs->make("CalibTree", "CalibTree"); tree->Branch("t_Run", &t_Run, "t_Run/I"); tree->Branch("t_Event", &t_Event, "t_Event/I"); @@ -703,12 +709,14 @@ void HcalIsoTrackStudy::beginJob() { tree->Branch("t_nVtx", &t_nVtx, "t_nVtx/I"); tree->Branch("t_nTrk", &t_nTrk, "t_nTrk/I"); tree->Branch("t_goodPV", &t_goodPV, "t_goodPV/I"); - tree->Branch("t_l1pt", &t_l1pt, "t_l1pt/D"); - tree->Branch("t_l1eta", &t_l1eta, "t_l1eta/D"); - tree->Branch("t_l1phi", &t_l1phi, "t_l1phi/D"); - tree->Branch("t_l3pt", &t_l3pt, "t_l3pt/D"); - tree->Branch("t_l3eta", &t_l3eta, "t_l3eta/D"); - tree->Branch("t_l3phi", &t_l3phi, "t_l3phi/D"); + if (((mode_ / 10) % 10) == 1) { + tree->Branch("t_l1pt", &t_l1pt, "t_l1pt/D"); + tree->Branch("t_l1eta", &t_l1eta, "t_l1eta/D"); + tree->Branch("t_l1phi", &t_l1phi, "t_l1phi/D"); + tree->Branch("t_l3pt", &t_l3pt, "t_l3pt/D"); + tree->Branch("t_l3eta", &t_l3eta, "t_l3eta/D"); + tree->Branch("t_l3phi", &t_l3phi, "t_l3phi/D"); + } tree->Branch("t_p", &t_p, "t_p/D"); tree->Branch("t_pt", &t_pt, "t_pt/D"); tree->Branch("t_phi", &t_phi, "t_phi/D"); @@ -755,19 +763,23 @@ void HcalIsoTrackStudy::beginJob() { t_trgbits = new std::vector(); tree->Branch("t_DetIds", "std::vector", &t_DetIds); tree->Branch("t_HitEnergies", "std::vector", &t_HitEnergies); - tree->Branch("t_trgbits", "std::vector", &t_trgbits); - tree->Branch("t_DetIds1", "std::vector", &t_DetIds1); - tree->Branch("t_HitEnergies1", "std::vector", &t_HitEnergies1); - tree->Branch("t_DetIds3", "std::vector", &t_DetIds3); - tree->Branch("t_HitEnergies3", "std::vector", &t_HitEnergies3); - tree->Branch("t_DetIdEC", "std::vector", &t_DetIdEC); - tree->Branch("t_HitEnergyEC", "std::vector", &t_HitEnergyEC); - tree->Branch("t_HitDistEC", "std::vector", &t_HitDistEC); - tree->Branch("t_DetIdHC", "std::vector", &t_DetIdHC); - tree->Branch("t_HitEnergyHC", "std::vector", &t_HitEnergyHC); - tree->Branch("t_HitDistHC", "std::vector", &t_HitDistHC); - + if (((mode_ / 10) % 10) == 1) { + tree->Branch("t_trgbits", "std::vector", &t_trgbits); + } + if ((mode_ % 10) == 1) { + tree->Branch("t_DetIds1", "std::vector", &t_DetIds1); + tree->Branch("t_HitEnergies1", "std::vector", &t_HitEnergies1); + tree->Branch("t_DetIds3", "std::vector", &t_DetIds3); + tree->Branch("t_HitEnergies3", "std::vector", &t_HitEnergies3); + tree->Branch("t_DetIdEC", "std::vector", &t_DetIdEC); + tree->Branch("t_HitEnergyEC", "std::vector", &t_HitEnergyEC); + tree->Branch("t_HitDistEC", "std::vector", &t_HitDistEC); + tree->Branch("t_DetIdHC", "std::vector", &t_DetIdHC); + tree->Branch("t_HitEnergyHC", "std::vector", &t_HitEnergyHC); + tree->Branch("t_HitDistHC", "std::vector", &t_HitDistHC); + } tree2 = fs->make("EventInfo", "Event Information"); + tree2->Branch("t_RunNo", &t_RunNo, "t_RunNo/i"); tree2->Branch("t_EventNo", &t_EventNo, "t_EventNo/i"); tree2->Branch("t_Tracks", &t_Tracks, "t_Tracks/I"); @@ -791,7 +803,9 @@ void HcalIsoTrackStudy::beginJob() { // ------------ method called when starting to processes a run ------------ void HcalIsoTrackStudy::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { - hdc_ = &iSetup.getData(tok_ddrec_); + edm::ESHandle pHRNDC; + iSetup.get().get(pHRNDC); + hdc_ = pHRNDC.product(); bool changed_(true); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed_); @@ -853,7 +867,7 @@ void HcalIsoTrackStudy::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("maxInMiss", 0); desc.add("maxOutMiss", 0); // Minimum momentum of selected isolated track and signal zone - desc.add("minimumTrackP", 20.0); + desc.add("minimumTrackP", 10.0); desc.add("coneRadius", 34.98); // signal zone in ECAL and MIP energy cutoff desc.add("coneRadiusMIP", 14.0); @@ -864,12 +878,12 @@ void HcalIsoTrackStudy::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("isolationEnergyTight", 2.0); desc.add("isolationEnergyLoose", 10.0); // energy thershold for ECAL (from Egamma group) - desc.add("EBHitEnergyThreshold", 0.08); - desc.add("EEHitEnergyThreshold0", 0.30); - desc.add("EEHitEnergyThreshold1", 0.00); - desc.add("EEHitEnergyThreshold2", 0.00); - desc.add("EEHitEnergyThreshold3", 0.00); - desc.add("EEHitEnergyThresholdLow", 0.30); + desc.add("EBHitEnergyThreshold", 0.10); + desc.add("EEHitEnergyThreshold0", -41.0664); + desc.add("EEHitEnergyThreshold1", 68.7950); + desc.add("EEHitEnergyThreshold2", -38.1483); + desc.add("EEHitEnergyThreshold3", 7.04303); + desc.add("EEHitEnergyThresholdLow", 0.08); desc.add("EEHitEnergyThresholdHigh", 0.30); // prescale factors desc.add("momentumLow", 40.0); @@ -897,6 +911,7 @@ void HcalIsoTrackStudy::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.addUntracked("useL1Trigger", false); desc.addUntracked("hcalScale", 1.0); desc.addUntracked("dataType", 0); + desc.addUntracked("outMode", 11); desc.addUntracked("unCorrect", false); desc.addUntracked("collapseDepth", false); desc.addUntracked("l1TrigName", "L1_SingleJet60"); @@ -1000,15 +1015,7 @@ std::array HcalIsoTrackStudy::fillTree(std::vectorgetPosition(eIds[k]); double eta = std::abs(pos.eta()); - double eThr(hitEthrEB_); - if (eIds[k].subdetId() != EcalBarrel) { - eThr = (((eta * hitEthrEE3_ + hitEthrEE2_) * eta + hitEthrEE1_) * eta + hitEthrEE0_); - if (eThr < hitEthrEELo_) - eThr = hitEthrEELo_; - else if (eThr > hitEthrEEHi_) - eThr = hitEthrEEHi_; - } - if (eHit[k] > eThr) + if (eHit[k] > eThreshold(eIds[k], eta)) eEcal += eHit[k]; } #ifdef EDM_ML_DEBUG @@ -1444,5 +1451,17 @@ void HcalIsoTrackStudy::TrackMap(unsigned int trkIndex, } } +double HcalIsoTrackStudy::eThreshold(const DetId& id, double eta) const { + double eThr(hitEthrEB_); + if (id.subdetId() != EcalBarrel) { + eThr = (((eta * hitEthrEE3_ + hitEthrEE2_) * eta + hitEthrEE1_) * eta + hitEthrEE0_); + if (eThr < hitEthrEELo_) + eThr = hitEthrEELo_; + else if (eThr > hitEthrEEHi_) + eThr = hitEthrEEHi_; + } + return eThr; +} + //define this as a plug-in DEFINE_FWK_MODULE(HcalIsoTrackStudy); diff --git a/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCProducer.cc b/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCProducer.cc index 6a6bda913de6e..83b504f1ff8a2 100644 --- a/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCProducer.cc +++ b/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCProducer.cc @@ -21,62 +21,43 @@ ________________________________________________________________**/ #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "TMath.h" //The class -class AlcaPCCProducer : public edm::one::EDProducer { +class AlcaPCCProducer + : public edm::one::EDProducer> { public: explicit AlcaPCCProducer(const edm::ParameterSet&); - ~AlcaPCCProducer() override; private: - void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override; - void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override; - void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) override; - void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; - - edm::EDGetTokenT > pixelToken; - edm::InputTag fPixelClusterLabel; - - std::string trigstring_; //specifies the trigger Rand or ZeroBias - int countEvt_; //counter - int countLumi_; //counter - - std::unique_ptr thePCCob; + std::shared_ptr globalBeginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, + edm::EventSetup const& iSetup) const final; + void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) final; + void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) final {} + void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) final; + + edm::EDGetTokenT> pixelToken_; + edm::EDPutTokenT putToken_; }; //-------------------------------------------------------------------------------------------------- -AlcaPCCProducer::AlcaPCCProducer(const edm::ParameterSet& iConfig) { - fPixelClusterLabel = iConfig.getParameter("pixelClusterLabel"); - trigstring_ = iConfig.getUntrackedParameter("trigstring", "alcaPCC"); - - countLumi_ = 0; - - produces(trigstring_); - pixelToken = consumes >(fPixelClusterLabel); -} - -//-------------------------------------------------------------------------------------------------- -AlcaPCCProducer::~AlcaPCCProducer() {} +AlcaPCCProducer::AlcaPCCProducer(const edm::ParameterSet& iConfig) + : pixelToken_(consumes(iConfig.getParameter("pixelClusterLabel"))), + //specifies the trigger Rand or ZeroBias + putToken_(produces( + iConfig.getUntrackedParameter("trigstring", "alcaPCC"))) {} //-------------------------------------------------------------------------------------------------- void AlcaPCCProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - countEvt_++; - unsigned int bx = iEvent.bunchCrossing(); //std::cout<<"The Bunch Crossing"<eventCounter(bx); + auto* pccOb = luminosityBlockCache(iEvent.getLuminosityBlock().index()); + pccOb->eventCounter(bx); //Looping over the clusters and adding the counts up - edm::Handle > hClusterColl; - iEvent.getByToken(pixelToken, hClusterColl); - - const edmNew::DetSetVector& clustColl = *(hClusterColl.product()); + const edmNew::DetSetVector& clustColl = iEvent.get(pixelToken_); // ---------------------------------------------------------------------- // -- Clusters without tracks for (auto const& mod : clustColl) { @@ -94,24 +75,21 @@ void AlcaPCCProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // nClusterCount++; //} int nCluster = mod.size(); - thePCCob->increment(detId(), bx, nCluster); + pccOb->increment(detId(), bx, nCluster); } } //-------------------------------------------------------------------------------------------------- -void AlcaPCCProducer::beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) { +std::shared_ptr AlcaPCCProducer::globalBeginLuminosityBlock( + edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& iSetup) const { //New PCC object at the beginning of each lumi section - thePCCob = std::make_unique(); - countLumi_++; + return std::make_shared(); } -//-------------------------------------------------------------------------------------------------- -void AlcaPCCProducer::endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) {} - //-------------------------------------------------------------------------------------------------- void AlcaPCCProducer::endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) { //Saving the PCC object - lumiSeg.put(std::move(thePCCob), std::string(trigstring_)); + lumiSeg.emplace(putToken_, std::move(*luminosityBlockCache(lumiSeg.index()))); } DEFINE_FWK_MODULE(AlcaPCCProducer); diff --git a/Calibration/TkAlCaRecoProducers/plugins/BuildFile.xml b/Calibration/TkAlCaRecoProducers/plugins/BuildFile.xml index 90ac441775da4..77617fc58ce2c 100644 --- a/Calibration/TkAlCaRecoProducers/plugins/BuildFile.xml +++ b/Calibration/TkAlCaRecoProducers/plugins/BuildFile.xml @@ -35,3 +35,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersAnalyzer.cc b/Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersAnalyzer.cc new file mode 100644 index 0000000000000..77adc0f8981e6 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersAnalyzer.cc @@ -0,0 +1,558 @@ +// -*- C++ -*- +// +// Package: Calibration/TkAlCaRecoProducers +// Class: NearbyPixelClustersAnalyzer +// +/**\class NearbyPixelClustersAnalyzer NearbyPixelClustersAnalyzer.cc Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersAnalyzer.cc + + Description: Analysis of the closebyPixelClusters collections +*/ +// +// Original Author: Marco Musich +// Created: Tue, 30 Mar 2021 09:22:07 GMT +// +// + +// system include files +#include + +// user include files +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileReader.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" +#include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" +#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" +#include "RecoLocalTracker/Records/interface/TkPixelCPERecord.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" +#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" +#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" + +#include "TH2F.h" +// +// class declaration +// + +class NearbyPixelClustersAnalyzer : public edm::one::EDAnalyzer { +public: + explicit NearbyPixelClustersAnalyzer(const edm::ParameterSet&); + ~NearbyPixelClustersAnalyzer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override{}; + std::map bookModuleHistograms(const TrackerTopology* tTopo); + std::tuple setTopoInfo(uint32_t detId, const TrackerTopology* tTopo); + void endJob() override; + + void countClusters(const edm::Handle& handle, + //const TrackerGeometry* tkGeom_, + unsigned int& nClusGlobal); + + bool detidIsOnPixel(const DetId& detid); + TrajectoryStateOnSurface getTrajectoryStateOnSurface(const TrajectoryMeasurement& measurement); + std::pair findClosestCluster(const edm::Handle& handle, + const PixelClusterParameterEstimator* pixelCPE_, + const TrackerGeometry* trackerGeometry_, + uint32_t rawId, + float traj_lx, + float traj_ly); + + void fillClusterFrames(const edm::Handle& handle); + + // ----------member data --------------------------- + const edm::ESGetToken geomEsToken_; + const edm::ESGetToken pixelCPEEsToken_; + const edm::ESGetToken geomEsTokenBR_; + const edm::ESGetToken topoEsTokenBR_; + + edm::EDGetTokenT clustersToken_; + edm::EDGetTokenT nearByClustersToken_; + edm::EDGetTokenT trajTrackCollectionToken_; + edm::EDGetTokenT>> distanceToken_; + edm::EDGetTokenT> muonTracksToken_; + + edm::Service fs; + + TH1I* h_nALCARECOClusters; + TH1I* h_nCloseByClusters; + TH1F* h_distClosestValid; + TH1F* h_distClosestMissing; + TH1F* h_distClosestInactive; + TH1F* h_distClosestTrack; + + SiPixelDetInfoFileReader reader_; + std::map outputFolders_; + std::map histoMap_; + bool phase_; +}; + +// +// constructors and destructor +// +NearbyPixelClustersAnalyzer::NearbyPixelClustersAnalyzer(const edm::ParameterSet& iConfig) + : geomEsToken_(esConsumes()), + pixelCPEEsToken_(esConsumes(edm::ESInputTag("", "PixelCPEGeneric"))), + geomEsTokenBR_(esConsumes()), + topoEsTokenBR_(esConsumes()), + clustersToken_(consumes(iConfig.getParameter("clusterCollection"))), + nearByClustersToken_( + consumes(iConfig.getParameter("nearByClusterCollection"))), + trajTrackCollectionToken_( + consumes(iConfig.getParameter("trajectoryInput"))), + distanceToken_(consumes>>(iConfig.getParameter("distToTrack"))), + muonTracksToken_(consumes>(iConfig.getParameter("muonTracks"))), + reader_(edm::FileInPath(iConfig.getParameter("skimmedGeometryPath")).fullPath()) { + usesResource(TFileService::kSharedResource); +} + +// +// member functions +// + +// ------------ method called for each event ------------ +void NearbyPixelClustersAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + // get the Tracker geometry from event setup + const TrackerGeometry* trackerGeometry_ = &iSetup.getData(geomEsToken_); + + // get the Pixel CPE from event setup + const PixelClusterParameterEstimator* pixelCPE_ = &iSetup.getData(pixelCPEEsToken_); + + // get the muon track collection + const auto& muonTrackCollectionHandle = iEvent.getHandle(muonTracksToken_); + auto const& muonTracks = *muonTrackCollectionHandle; + + // get the track distances + const auto& distancesToTrack = iEvent.getHandle(distanceToken_); + + unsigned int nMuons = muonTracks.size(); + for (unsigned int ij = 0; ij < nMuons; ij++) { + auto muon = muonTrackCollectionHandle->ptrAt(ij); + edm::RefToBase trackRef = muonTrackCollectionHandle->refAt(ij); + const auto& distances = (*distancesToTrack)[trackRef]; + + LogDebug("NearbyPixelClustersAnalyzer") << "distances size: " << distances.size() << std::endl; + + unsigned counter = 0; + double closestDR = 999.; + for (const auto& distance : distances) { + counter++; + LogDebug("NearbyPixelClustersAnalyzer") + << "track: " << counter << " distance:" << std::sqrt(distance) << std::endl; + if (distance < closestDR && distance > 0) { + closestDR = distance; + } + } + + h_distClosestTrack->Fill(std::sqrt(closestDR)); + } + + // Get cluster collection + const auto& clusterCollectionHandle = iEvent.getHandle(clustersToken_); + + unsigned int nClusGlobal = 0; + countClusters(clusterCollectionHandle, nClusGlobal); + + h_nALCARECOClusters->Fill(nClusGlobal); + edm::LogInfo("NearbyPixelClustersAnalyzer") << "total ALCARECO clusters: " << nClusGlobal << std::endl; + + // Get nearby cluster collection + const auto& nearByClusterCollectionHandle = iEvent.getHandle(nearByClustersToken_); + + unsigned int nNearByClusGlobal = 0; + countClusters(nearByClusterCollectionHandle, /*trackerGeometry_,*/ nNearByClusGlobal); + + h_nCloseByClusters->Fill(nNearByClusGlobal); + edm::LogInfo("NearbyPixelClustersAnalyzer") << "total close-by clusters: " << nNearByClusGlobal << std::endl; + + // fill the detector frames + fillClusterFrames(nearByClusterCollectionHandle); + + // Get Traj-Track Collection + const auto& trajTrackCollectionHandle = iEvent.getHandle(trajTrackCollectionToken_); + + if (!trajTrackCollectionHandle.isValid()) + return; + + for (const auto& pair : *trajTrackCollectionHandle) { + const edm::Ref> traj = pair.key; + const reco::TrackRef track = pair.val; + + for (const TrajectoryMeasurement& measurement : traj->measurements()) { + if (!measurement.updatedState().isValid()) + return; + + const TransientTrackingRecHit::ConstRecHitPointer& recHit = measurement.recHit(); + + // Only looking for pixel hits + DetId r_rawId = recHit->geographicalId(); + + if (!this->detidIsOnPixel(r_rawId)) + continue; + + // Skipping hits with undeterminable positions + TrajectoryStateOnSurface trajStateOnSurface = this->getTrajectoryStateOnSurface(measurement); + + if (!(trajStateOnSurface.isValid())) + continue; + + // Position measurements + // Looking for valid and missing hits + LocalPoint localPosition = trajStateOnSurface.localPosition(); + + const auto& traj_lx = localPosition.x(); + const auto& traj_ly = localPosition.y(); + + const auto loc = this->findClosestCluster( + nearByClusterCollectionHandle, pixelCPE_, trackerGeometry_, r_rawId.rawId(), traj_lx, traj_ly); + + float dist = (loc.first != -999.) ? std::sqrt(loc.first * loc.first + loc.second * loc.second) : -0.1; + + if (recHit->getType() == TrackingRecHit::valid) { + edm::LogInfo("NearbyPixelClustersAnalyzer") + << "RawID:" << r_rawId.rawId() << " (valid hit), distance: " << dist << std::endl; + h_distClosestValid->Fill(dist); + } + + if (recHit->getType() == TrackingRecHit::missing) { + edm::LogInfo("NearbyPixelClustersAnalyzer") + << "RawID:" << r_rawId.rawId() << " (missing hit), distance: " << dist << std::endl; + h_distClosestMissing->Fill(dist); + } + + if (recHit->getType() == TrackingRecHit::inactive) { + edm::LogInfo("NearbyPixelClustersAnalyzer") + << "RawID:" << r_rawId.rawId() << " (inactive hit), distance: " << dist << std::endl; + h_distClosestInactive->Fill(dist); + } + } + } +} + +// ------------ method called once each job just before starting event loop ------------ +void NearbyPixelClustersAnalyzer::beginJob() { + TFileDirectory ClusterCounts = fs->mkdir("ClusterCounts"); + h_nALCARECOClusters = ClusterCounts.make( + "h_nALCARECOClusters", "Number of Pixel clusters per event (ALCARECO) ;N_{clusters};events", 20, 0, 20); + h_nCloseByClusters = ClusterCounts.make( + "h_nCloseByClusters", "Number of Pixel clusters per event (close-by) ;N_{clusters};events", 20, 0, 20); + + TFileDirectory Distances = fs->mkdir("TrajDistance"); + h_distClosestValid = Distances.make( + "h_distClosestValid", + "Distance of Closest cluster to trajectory (valid);distance (cm); valid trajectory measurements", + 110, + -0.105, + 0.995); + h_distClosestMissing = Distances.make( + "h_distClosestMissing", + "Distance of Closest cluster to trajectory (missing);distance (cm);missing trajectory measurements", + 110, + -0.105, + 0.995); + h_distClosestInactive = Distances.make( + "h_distClosestInactive", + "Distance of Closest cluster to trajectory (inactive);distance (cm);inactive trajectory measurements", + 110, + -0.105, + 0.995); + + TFileDirectory TkDistances = fs->mkdir("OtherTrackDistance"); + h_distClosestTrack = TkDistances.make( + "h_distClosestTrack", + "#DeltaR Distance of Closest track to the muon trajectory;#DeltaR distance; muon trajectories", + 100, + 0., + 5.); +} + +// ------------ method called once each job just after ending the event loop ------------ +void NearbyPixelClustersAnalyzer::endJob() { + // please remove this method if not needed +} + +/*--------------------------------------------------------------------*/ +bool NearbyPixelClustersAnalyzer::detidIsOnPixel(const DetId& detid) +/*--------------------------------------------------------------------*/ +{ + if (detid.det() != DetId::Tracker) + return false; + if (detid.subdetId() == PixelSubdetector::PixelBarrel) + return true; + if (detid.subdetId() == PixelSubdetector::PixelEndcap) + return true; + return false; +} + +/*--------------------------------------------------------------------*/ +TrajectoryStateOnSurface NearbyPixelClustersAnalyzer::getTrajectoryStateOnSurface( + const TrajectoryMeasurement& measurement) +/*--------------------------------------------------------------------*/ +{ + const static TrajectoryStateCombiner trajStateCombiner; + + const auto& forwardPredictedState = measurement.forwardPredictedState(); + const auto& backwardPredictedState = measurement.backwardPredictedState(); + + if (forwardPredictedState.isValid() && backwardPredictedState.isValid()) + return trajStateCombiner(forwardPredictedState, backwardPredictedState); + + else if (backwardPredictedState.isValid()) + return backwardPredictedState; + + else if (forwardPredictedState.isValid()) + return forwardPredictedState; + + edm::LogError("NearbyPixelClusterProducer") << "Error saving traj. measurement data." + << " Trajectory state on surface cannot be determined." << std::endl; + + return TrajectoryStateOnSurface(); +} + +/*--------------------------------------------------------------------*/ +void NearbyPixelClustersAnalyzer::countClusters(const edm::Handle& handle, + //const TrackerGeometry* tkGeom_, + unsigned int& nClusGlobal) +/*--------------------------------------------------------------------*/ +{ + for (const auto& DSVItr : *handle) { + uint32_t rawid(DSVItr.detId()); + DetId detId(rawid); + LogDebug("NearbyPixelClustersAnalyzer") << "DetId: " << detId.rawId() << " size: " << DSVItr.size() << std::endl; + nClusGlobal += DSVItr.size(); + } +} + +/*--------------------------------------------------------------------*/ +std::pair NearbyPixelClustersAnalyzer::findClosestCluster( + const edm::Handle& handle, + const PixelClusterParameterEstimator* pixelCPE_, + const TrackerGeometry* trackerGeometry_, + uint32_t rawId, + float traj_lx, + float traj_ly) +/*--------------------------------------------------------------------*/ +{ + const SiPixelClusterCollectionNew& clusterCollection = *handle; + SiPixelClusterCollectionNew::const_iterator itClusterSet = clusterCollection.begin(); + + float minD = 10000.; + + auto loc = std::make_pair(-999., -999.); + + for (; itClusterSet != clusterCollection.end(); itClusterSet++) { + DetId detId(itClusterSet->id()); + if (detId.rawId() != rawId) + continue; + + unsigned int subDetId = detId.subdetId(); + if (subDetId != PixelSubdetector::PixelBarrel && subDetId != PixelSubdetector::PixelEndcap) { + edm::LogError("NearByPixelClustersAnalyzer") + << "ERROR: not a pixel cluster!!!" << std::endl; // should not happen + continue; + } + + const PixelGeomDetUnit* pixdet = (const PixelGeomDetUnit*)trackerGeometry_->idToDetUnit(detId); + edmNew::DetSet::const_iterator itCluster = itClusterSet->begin(); + for (; itCluster != itClusterSet->end(); ++itCluster) { + LocalPoint lp(itCluster->x(), itCluster->y(), 0.); + PixelClusterParameterEstimator::ReturnType params = pixelCPE_->getParameters(*itCluster, *pixdet); + lp = std::get<0>(params); + + float D = sqrt((lp.x() - traj_lx) * (lp.x() - traj_lx) + (lp.y() - traj_ly) * (lp.y() - traj_ly)); + if (D < minD) { + minD = D; + loc.first = (lp.x() - traj_lx); + loc.second = (lp.y() - traj_ly); + } + } // loop on cluster sets + } + return loc; +} + +void NearbyPixelClustersAnalyzer::fillClusterFrames(const edm::Handle& handle) { + const SiPixelClusterCollectionNew& clusterCollection = *handle; + SiPixelClusterCollectionNew::const_iterator itClusterSet = clusterCollection.begin(); + + for (; itClusterSet != clusterCollection.end(); itClusterSet++) { + DetId detId(itClusterSet->id()); + + edmNew::DetSet::const_iterator itCluster = itClusterSet->begin(); + for (; itCluster != itClusterSet->end(); ++itCluster) { + const std::vector pixelsVec = (*itCluster).pixels(); + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index + float pixel_charge = pixelsVec[i].adc; + histoMap_[detId.rawId()]->Fill(pixy, pixx, pixel_charge); + } + } + } +} + +// ------------ method called for each run ------------------------------------------ +void NearbyPixelClustersAnalyzer::beginRun(const edm::Run& iRun, edm::EventSetup const& iSetup) +/*-----------------------------------------------------------------------------------*/ +{ + edm::LogInfo("NearbyPixelClustersAnalyzer") + << "@SUB=NearbyPixelClustersAnalyzer::beginRun() before booking histoMap_.size(): " << histoMap_.size() + << std::endl; + + const TrackerTopology* tTopo_ = &iSetup.getData(topoEsTokenBR_); + const TrackerGeometry* pDD_ = &iSetup.getData(geomEsTokenBR_); + + if ((pDD_->isThere(GeomDetEnumerators::P1PXB)) || (pDD_->isThere(GeomDetEnumerators::P1PXEC))) { + phase_ = true; + } else { + phase_ = false; + } + + unsigned nPixelDets = 0; + for (const auto& it : pDD_->detUnits()) { + const PixelGeomDetUnit* mit = dynamic_cast(it); + if (mit != nullptr) { + nPixelDets++; + } + } + + const auto& detIds = reader_.getAllDetIds(); + if (detIds.size() != nPixelDets) { + throw cms::Exception("Inconsistent Data") + << "The size of the detId list specified from file (" << detIds.size() + << ") differs from the one in TrackerGeometry (" << nPixelDets << ")! Please cross-check" << std::endl; + } + + for (const auto& it : detIds) { + auto topolInfo = setTopoInfo(it, tTopo_); + + std::string thePart = std::get<0>(topolInfo); + + // book the TFileDirectory if it's not already done + if (!outputFolders_.count(thePart)) { + LogDebug("NearbyPixelClustersAnalyzer") << "booking " << thePart << std::endl; + outputFolders_[thePart] = fs->mkdir(thePart); + } + } + + if (histoMap_.empty()) { + histoMap_ = bookModuleHistograms(tTopo_); + } + + edm::LogInfo("NearbyPixelClusterAnalyzer") + << "@SUB=NearbyPixelClusterAnalyzer::beginRun() After booking histoMap_.size(): " << histoMap_.size() + << std::endl; +} + +// ------------ method called to determine the topology ------------ +std::tuple NearbyPixelClustersAnalyzer::setTopoInfo(uint32_t detId, + const TrackerTopology* tTopo) +/*-----------------------------------------------------------------------------------*/ +{ + int subdetId_(-999), layer_(-999), side_(-999); + std::string ret = ""; + + subdetId_ = DetId(detId).subdetId(); + switch (subdetId_) { + case PixelSubdetector::PixelBarrel: // PXB + layer_ = tTopo->pxbLayer(detId); + side_ = 0; + ret += Form("BPix_Layer%i", layer_); + break; + case PixelSubdetector::PixelEndcap: //PXF + side_ = tTopo->pxfSide(detId); + layer_ = tTopo->pxfDisk(detId); + ret += ("FPix_"); + ret += (side_ == 1) ? Form("P_disk%i", layer_) : Form("M_disk%i", layer_); + break; + default: + edm::LogError("NearbyPixelClusterAnalyzer") << "we should never be here!" << std::endl; + break; + } + + return std::make_tuple(ret, subdetId_, layer_, side_); +} + +/* ------------ method called once to book all the module level histograms ---------*/ +std::map NearbyPixelClustersAnalyzer::bookModuleHistograms(const TrackerTopology* tTopo_) +/*-----------------------------------------------------------------------------------*/ +{ + std::map hd; + + const auto& detIds = reader_.getAllDetIds(); + for (const auto& it : detIds) { + // check if det id is correct and if it is actually cabled in the detector + if (it == 0 || it == 0xFFFFFFFF) { + edm::LogError("DetIdNotGood") << "@SUB=analyze" + << "Wrong det id: " << it << " ... neglecting!" << std::endl; + continue; + } + + auto topolInfo = setTopoInfo(it, tTopo_); + std::string thePart = std::get<0>(topolInfo); + + unsigned int nCols = reader_.getDetUnitDimensions(it).first; + unsigned int nRows = reader_.getDetUnitDimensions(it).second; + + int subdetId = DetId(it).subdetId(); + + std::string moduleName = (subdetId == PixelSubdetector::PixelBarrel) ? PixelBarrelName(it, tTopo_, phase_).name() + : PixelEndcapName(it, tTopo_, phase_).name(); + + hd[it] = outputFolders_[thePart].make( + Form("ClusterFrame_%s", moduleName.c_str()), + Form("Cluster Map for module %s;n. cols;n. rows;pixel charge [ADC counts]", moduleName.c_str()), + nCols, + 0, + nCols, + nRows, + 0, + nRows); + } + + return hd; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void NearbyPixelClustersAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Analysis of the closebyPixelClusters collections"); + desc.add("clusterCollection", edm::InputTag("ALCARECOSiPixelCalSingleMuonTight")); + desc.add("nearByClusterCollection", edm::InputTag("closebyPixelClusters")); + desc.add("trajectoryInput", edm::InputTag("refittedTracks")); + desc.add("muonTracks", edm::InputTag("ALCARECOSiPixelCalSingleMuonTight")); + desc.add("distToTrack", edm::InputTag("trackDistances")); + desc.add("skimmedGeometryPath", + "SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt"); + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(NearbyPixelClustersAnalyzer); diff --git a/Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersProducer.cc b/Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersProducer.cc new file mode 100644 index 0000000000000..0411b72144457 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersProducer.cc @@ -0,0 +1,438 @@ +// -*- C++ -*- +// +// Package: Calibration/TkAlCaRecoProducers +// Class: NearbyPixelClustersProducer +// +/**\class NearbyPixelClustersProducer NearbyPixelClustersProducer.cc Calibration/TkAlCaRecoProducers/plugins/NearbyPixelClustersProducer.cc + + Description: Class to produce the collection of SiPixelClusters closest, hit by hit, to the trajectory measurements of a given track + + Implementation: + Implementation of this class is heavily endebted to https://github.com/jkarancs/PhaseIPixelNtuplizer/blob/master/plugins/PhaseIPixelNtuplizer.h + +*/ +// +// Original Author: Marco Musich +// Created: Mon, 29 Mar 2021 12:29:30 GMT +// +// + +// system include files +#include +#include + +// user include files +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" +#include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" +#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" +#include "RecoLocalTracker/Records/interface/TkPixelCPERecord.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" +#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" +#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityFromDbRcd.h" + +using trajCrossings_t = std::map>; + +// +// class declaration +// + +class NearbyPixelClustersProducer : public edm::stream::EDProducer<> { +public: + explicit NearbyPixelClustersProducer(const edm::ParameterSet&); + ~NearbyPixelClustersProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + const trajCrossings_t findAllTrajectoriesCrossings( + const edm::Handle& trajTrackCollectionHandle); + + const std::vector::const_iterator> findAllNearbyClusters( + const SiPixelClusterCollectionNew::const_iterator& clusterSet, + const uint32_t rawId, + const std::vector& vLocalPos); + + const std::vector::const_iterator> findAllNearbyClusters( + const SiPixelClusterCollectionNew& clusterSet, const uint32_t rawId, const std::vector& vLocalPos); + + TrajectoryStateOnSurface getTrajectoryStateOnSurface(const TrajectoryMeasurement& measurement); + bool detidIsOnPixel(const DetId& detid); + + // ----------member data --------------------------- + + // switches + const bool throwBadComponents_; + const bool dumpWholeDetId_; + + // esTokens + const edm::ESGetToken geomEsToken_; + const edm::ESGetToken pixelCPEEsToken_; + const edm::ESGetToken badModuleToken_; + + // edToken + edm::EDGetTokenT clustersToken_; + edm::EDGetTokenT trajTrackCollectionToken_; + + // putToken + edm::EDPutTokenT clusterPutToken_; + + // event setup + const TrackerGeometry* trackerGeometry_; + const PixelClusterParameterEstimator* pixelCPE_; +}; + +// +// constructors and destructor +// +NearbyPixelClustersProducer::NearbyPixelClustersProducer(const edm::ParameterSet& iConfig) + : throwBadComponents_(iConfig.getParameter("throwBadComponents")), + dumpWholeDetId_(iConfig.getParameter("dumpWholeDetIds")), + geomEsToken_(esConsumes()), + pixelCPEEsToken_(esConsumes(edm::ESInputTag("", "PixelCPEGeneric"))), + badModuleToken_(esConsumes()), + clustersToken_(consumes(iConfig.getParameter("clusterCollection"))), + trajTrackCollectionToken_( + consumes(iConfig.getParameter("trajectoryInput"))), + clusterPutToken_(produces()) { + if (dumpWholeDetId_) { + edm::LogPrint("NearbyPixelClustersProducer") << "WARNING: selected to dump the whole DetId's worth of clusters.\n " + "This will have consequences on the event size!" + << std::endl; + } +} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +void NearbyPixelClustersProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + auto outputClusters = std::make_unique(); + + // get the Tracker geometry from event setup + trackerGeometry_ = &iSetup.getData(geomEsToken_); + + // get the Pixel CPE from event setup + pixelCPE_ = &iSetup.getData(pixelCPEEsToken_); + + const auto& SiPixelBadModule_ = &iSetup.getData(badModuleToken_); + + // get cluster collection + const auto& clusterCollectionHandle = iEvent.getHandle(clustersToken_); + const SiPixelClusterCollectionNew& clusterCollection = *clusterCollectionHandle; + + // get Traj-Track Collection + const auto& trajTrackCollectionHandle = iEvent.getHandle(trajTrackCollectionToken_); + if (!trajTrackCollectionHandle.isValid()) + return; + + // find all trajectory crossings in the event + const auto& allCrossings = this->findAllTrajectoriesCrossings(trajTrackCollectionHandle); + + LogDebug("NearbyPixelClustersProducer") << allCrossings.size() << std::endl; + + // now find all nearby clusters + for (const auto& [id, vLocalPos] : allCrossings) { + // prepare the filler + SiPixelClusterCollectionNew::FastFiller spc(*outputClusters, id); + + // retrieve the clusters of the right detId + const auto& clustersOnDet = clusterCollection.find(DetId(id)); + + if (clustersOnDet == clusterCollection.end()) + continue; + + // if the cluster DetSet is not valid, move on + if (!(*clustersOnDet).isValid()) + continue; + + // if the module is bad continue + if (throwBadComponents_ && SiPixelBadModule_->IsModuleBad(id)) + continue; + + // find all the clusters to put into the event + const auto& clustersToPut = this->findAllNearbyClusters(clustersOnDet, id, vLocalPos); + + // find all the clusters to put into the event (different interface) + //const auto& clustersToPut = this->findAllNearbyClusters(clusterCollection, id, vLocalPos); + + for (const auto& cluster : clustersToPut) { + spc.push_back(*cluster); + } + + if (spc.empty()) + spc.abort(); + + } // loop on trajectory crossings + + iEvent.put(clusterPutToken_, std::move(outputClusters)); +} + +/*--------------------------------------------------------------------*/ +const trajCrossings_t NearbyPixelClustersProducer::findAllTrajectoriesCrossings( + const edm::Handle& trajTrackCollectionHandle) +/*--------------------------------------------------------------------*/ +{ + trajCrossings_t crossings; + + std::vector treatedIds; + + for (const auto& pair : *trajTrackCollectionHandle) { + const edm::Ref> traj = pair.key; + + for (const TrajectoryMeasurement& measurement : traj->measurements()) { + //Check if the measurement infos can be read + if (!measurement.updatedState().isValid()) + continue; + + const TransientTrackingRecHit::ConstRecHitPointer& recHit = measurement.recHit(); + + // Only looking for pixel hits + DetId recHitDetid = recHit->geographicalId(); + const auto& rawId = recHitDetid.rawId(); + + if (!this->detidIsOnPixel(recHitDetid)) + continue; + + // Skipping hits with undeterminable positions + TrajectoryStateOnSurface trajStateOnSurface = this->getTrajectoryStateOnSurface(measurement); + + if (!(trajStateOnSurface.isValid())) + continue; + + // Position measurements + // Looking for valid and missing hits + LocalPoint localPosition = trajStateOnSurface.localPosition(); + + if (std::find(treatedIds.begin(), treatedIds.end(), rawId) != treatedIds.end()) { + crossings.at(rawId).push_back(localPosition); + } else { + crossings.insert(std::pair>(rawId, {localPosition})); + treatedIds.push_back(rawId); + } + } // loop on measurements in trajectory + } // loop on trajectories + + return crossings; +} + +/*--------------------------------------------------------------------*/ +const std::vector::const_iterator> NearbyPixelClustersProducer::findAllNearbyClusters( + const SiPixelClusterCollectionNew::const_iterator& clusterSet, + const uint32_t rawId, + const std::vector& vLocalPos) +/*--------------------------------------------------------------------*/ +{ + std::vector::const_iterator> outputClusters; + + static constexpr unsigned int k_maxClustersInDet = 1024; + + // something funny is going on here ... + if ((*clusterSet).size() > k_maxClustersInDet) { + edm::LogWarning("NearbyPixelClustersProducer") + << __func__ << "() number of clusters in det " << rawId /*(*clusterSet).id()*/ << " is " << (*clusterSet).size() + << ", which is larger than maximum (1024).\n Something funny with the data is going on!" << std::endl; + return outputClusters; + } + + const PixelGeomDetUnit* pixdet = (const PixelGeomDetUnit*)trackerGeometry_->idToDetUnit(rawId); + edmNew::DetSet::const_iterator itCluster = clusterSet->begin(); + + // just copy straight the whole set of clusters in the detid + if (dumpWholeDetId_) { + for (; itCluster != clusterSet->end(); ++itCluster) { + outputClusters.push_back(itCluster); + } + return outputClusters; + } + + int count = 0; + for (const auto& localPos : vLocalPos) { + count++; + //trajectory crossing local coordinates + const auto& traj_lx = localPos.x(); + const auto& traj_ly = localPos.y(); + + float minD = 10000.; + edmNew::DetSet::const_iterator closest = nullptr; + + //std::cout<< rawId << " count: " << count << " n. clusters: " << (*clusterSet).size() << std::endl; + LogDebug("NearbyPixelClustersProducer") + << __func__ << rawId << " count: " << count << " n. clusters: " << (*clusterSet).size() << std::endl; + + for (; itCluster != clusterSet->end(); ++itCluster) { + LocalPoint lp(itCluster->x(), itCluster->y(), 0.); + const auto& params = pixelCPE_->getParameters(*itCluster, *pixdet); + lp = std::get<0>(params); + + float D = sqrt((lp.x() - traj_lx) * (lp.x() - traj_lx) + (lp.y() - traj_ly) * (lp.y() - traj_ly)); + if (D < minD) { + closest = itCluster; + minD = D; + } + } // loop on cluster sets + + if (closest) { + outputClusters.push_back(closest); + } + } // loop on the trajectory crossings + + return outputClusters; +} + +// overloaded method: use the whole DetSet +/*--------------------------------------------------------------------*/ +const std::vector::const_iterator> NearbyPixelClustersProducer::findAllNearbyClusters( + const SiPixelClusterCollectionNew& clusterCollection, + const uint32_t rawId, + const std::vector& vLocalPos) +/*--------------------------------------------------------------------*/ +{ + std::vector::const_iterator> outputClusters; + + int count = 0; + for (const auto& localPos : vLocalPos) { + count++; + + //trajectory crossing local coordinates + const auto& traj_lx = localPos.x(); + const auto& traj_ly = localPos.y(); + + float minD = 10000.; + + SiPixelClusterCollectionNew::const_iterator itClusterSet = clusterCollection.begin(); + for (; itClusterSet != clusterCollection.end(); itClusterSet++) { + DetId detId(itClusterSet->id()); + if (detId.rawId() != rawId) + continue; + + unsigned int subDetId = detId.subdetId(); + if (subDetId != PixelSubdetector::PixelBarrel && subDetId != PixelSubdetector::PixelEndcap) { + edm::LogError("NearByPixelClusterProducer") + << "ERROR: not a pixel cluster!!!" << std::endl; // should not happen + continue; + } + + edmNew::DetSet::const_iterator itCluster = itClusterSet->begin(); + + // just copy straight the whole set of clusters in the detid + if (dumpWholeDetId_ && count == 1) { + for (; itCluster != itClusterSet->end(); ++itCluster) { + outputClusters.push_back(itCluster); + } + return outputClusters; + } + + //std::cout<< rawId << " count: " << count << " n. clusters: " << (*clusterSet).size() << std::endl; + LogDebug("NearbyPixelClustersProducer") + << __func__ << rawId << " count: " << count << " n. clusters: " << (*itClusterSet).size() << std::endl; + + const PixelGeomDetUnit* pixdet = (const PixelGeomDetUnit*)trackerGeometry_->idToDetUnit(rawId); + + edmNew::DetSet::const_iterator closest = nullptr; + + for (; itCluster != itClusterSet->end(); ++itCluster) { + LocalPoint lp(itCluster->x(), itCluster->y(), 0.); + const auto& params = pixelCPE_->getParameters(*itCluster, *pixdet); + lp = std::get<0>(params); + + float D = sqrt((lp.x() - traj_lx) * (lp.x() - traj_lx) + (lp.y() - traj_ly) * (lp.y() - traj_ly)); + if (D < minD) { + closest = itCluster; + minD = D; + } + } // loop on cluster sets + + if (closest) { + outputClusters.push_back(closest); + } + } // loop on all clusters + } // loop on the trajectory crossings + + return outputClusters; +} + +/*--------------------------------------------------------------------*/ +bool NearbyPixelClustersProducer::detidIsOnPixel(const DetId& detid) +/*--------------------------------------------------------------------*/ +{ + if (detid.det() != DetId::Tracker) + return false; + if (detid.subdetId() == PixelSubdetector::PixelBarrel) + return true; + if (detid.subdetId() == PixelSubdetector::PixelEndcap) + return true; + return false; +} + +/*--------------------------------------------------------------------*/ +TrajectoryStateOnSurface NearbyPixelClustersProducer::getTrajectoryStateOnSurface( + const TrajectoryMeasurement& measurement) +/*--------------------------------------------------------------------*/ +{ + const static TrajectoryStateCombiner trajStateCombiner; + + const auto& forwardPredictedState = measurement.forwardPredictedState(); + const auto& backwardPredictedState = measurement.backwardPredictedState(); + + if (forwardPredictedState.isValid() && backwardPredictedState.isValid()) + return trajStateCombiner(forwardPredictedState, backwardPredictedState); + + else if (backwardPredictedState.isValid()) + return backwardPredictedState; + + else if (forwardPredictedState.isValid()) + return forwardPredictedState; + + edm::LogError("NearbyPixelClustersProducer") << "Error saving traj. measurement data." + << " Trajectory state on surface cannot be determined." << std::endl; + + return TrajectoryStateOnSurface(); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void NearbyPixelClustersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment( + "Produces the collection of SiPixelClusters closest, hit by hit, to the trajectory measurements of a given " + "track"); + desc.add("throwBadComponents", false) + ->setComment( + "do not consider modules flagged as bad components. Careful, it changes the efficiency denominator!"); + desc.add("dumpWholeDetIds", false) + ->setComment("put in the event all the pixel cluster on the impacted module, by default only the closest"); + ; + desc.add("clusterCollection", edm::InputTag("siPixelClusters")); + desc.add("trajectoryInput", edm::InputTag("myRefitter")); + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(NearbyPixelClustersProducer); diff --git a/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc b/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc new file mode 100644 index 0000000000000..8e94b94e8b3b6 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc @@ -0,0 +1,150 @@ +// -*- C++ -*- +// +// Package: Calibration/TkAlCaRecoProducers +// Class: TrackDistanceValueMapProducer +// +/**\class TrackDistanceValueMapProducer TrackDistanceValueMapProducer.cc Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc + + Description: creates a value map for each saved muon track with all the distances of the other track w.r.t. the muon track + +*/ +// +// Original Author: Marco Musich +// Created: Mon, 12 Apr 2021 11:59:39 GMT +// +// + +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" + +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" + +#include "DataFormats/Math/interface/deltaR.h" +// +// class declaration +// + +class TrackDistanceValueMapProducer : public edm::global::EDProducer<> { +public: + explicit TrackDistanceValueMapProducer(const edm::ParameterSet&); + ~TrackDistanceValueMapProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + + // ----------member data --------------------------- + // edToken + edm::EDGetTokenT> muonTracksToken_; + edm::EDGetTokenT> otherTracksToken_; + + // save in the event only up to the n-th closest + unsigned int nthClosestTrack_; + + // putToken + edm::EDPutTokenT>> distancesPutToken_; +}; + +// +// constructors and destructor +// +TrackDistanceValueMapProducer::TrackDistanceValueMapProducer(const edm::ParameterSet& iConfig) + : muonTracksToken_(consumes>(iConfig.getParameter("muonTracks"))), + otherTracksToken_(consumes>(iConfig.getParameter("allTracks"))), + nthClosestTrack_(iConfig.getParameter("saveUpToNthClosest")), + distancesPutToken_(produces>>()) {} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +void TrackDistanceValueMapProducer::produce(edm::StreamID streamID, + edm::Event& iEvent, + const edm::EventSetup& iSetup) const { + using namespace edm; + + //======================================================= + // Retrieve the muon Track information + //======================================================= + + const auto& muonTrackCollectionHandle = iEvent.getHandle(muonTracksToken_); + if (!muonTrackCollectionHandle.isValid()) + return; + auto const& muonTracks = *muonTrackCollectionHandle; + + //======================================================= + // Retrieve the general Track information + //======================================================= + + const auto& allTrackCollectionHandle = iEvent.getHandle(otherTracksToken_); + if (!allTrackCollectionHandle.isValid()) + return; + auto const& allTracks = *allTrackCollectionHandle; + + //======================================================= + // fill the distance vector + //======================================================= + + // the map cannot be filled straight away, so create an intermediate vector + unsigned int Nit = muonTracks.size(); + unsigned int Nall = allTracks.size(); + std::vector> v2_dR2; + + for (unsigned int iit = 0; iit < Nit; iit++) { + const auto& muontrack = muonTracks.ptrAt(iit); + + std::vector v_dR2; + for (unsigned int iAll = 0; iAll < Nall; iAll++) { + const auto& recotrack = allTracks.ptrAt(iAll); + const float dR2 = ::deltaR2(*muontrack, *recotrack); + if (dR2 != 0.f) { // exclude the track itself + v_dR2.push_back(dR2); + } + } + + // sort the tracks in ascending order of distance + std::sort(v_dR2.begin(), v_dR2.end(), [](const float& lhs, const float& rhs) { return lhs < rhs; }); + + // just copy the first nth + std::vector reduced_vdR2; + std::copy(v_dR2.begin(), v_dR2.begin() + nthClosestTrack_, std::back_inserter(reduced_vdR2)); + v2_dR2.push_back(reduced_vdR2); + } + + //======================================================= + // Populate the event with the value map + //======================================================= + + std::unique_ptr>> vm_dR2(new edm::ValueMap>()); + edm::ValueMap>::Filler filler(*vm_dR2); + filler.insert(muonTrackCollectionHandle, v2_dR2.begin(), v2_dR2.end()); + filler.fill(); + iEvent.put(distancesPutToken_, std::move(vm_dR2)); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void TrackDistanceValueMapProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Produces a value map with all the distances with the other tracks in the event"); + desc.add("muonTracks", edm::InputTag("ALCARECOSiPixelCalSingleMuonTight")) + ->setComment("the probe muon tracks"); + desc.add("allTracks", edm::InputTag("generalTracks"))->setComment("all tracks in the event"); + desc.add("saveUpToNthClosest", 1)->setComment("save the distance only for the nth closest tracks"); + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(TrackDistanceValueMapProducer); diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_Output_cff.py new file mode 100644 index 0000000000000..acc29836ec878 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_Output_cff.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOSiPixelCalSingleMuonLoose_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOSiPixelCalSingleMuonLoose') + ), + outputCommands = cms.untracked.vstring( + 'keep *_ALCARECOSiPixelCalSingleMuonLoose_*_*', + 'keep *_muons__*', + 'keep *_offlinePrimaryVertices_*_*', + 'keep *_*riggerResults_*_HLT' + ) +) + +OutALCARECOSiPixelCalSingleMuonLoose=OutALCARECOSiPixelCalSingleMuonLoose_noDrop.clone() +OutALCARECOSiPixelCalSingleMuonLoose.outputCommands.insert(0, "drop *") diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_cff.py new file mode 100644 index 0000000000000..26c8d8e54625a --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonLoose_cff.py @@ -0,0 +1,34 @@ +import FWCore.ParameterSet.Config as cms + +################################################################## +# AlCaReco for track based calibration using single muon events +################################################################## +from HLTrigger.HLTfilters.hltHighLevel_cfi import * +ALCARECOSiPixelCalSingleMuonLooseHLTFilter = hltHighLevel.clone() +ALCARECOSiPixelCalSingleMuonLooseHLTFilter.andOr = True ## choose logical OR between Triggerbits +ALCARECOSiPixelCalSingleMuonLooseHLTFilter.throw = False ## dont throw on unknown path names +ALCARECOSiPixelCalSingleMuonLooseHLTFilter.eventSetupPathsKey = 'SiPixelCalSingleMuon' + +################################################################## +# Basic track selection +################################################################## +import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi +ALCARECOSiPixelCalSingleMuonLoose = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone() +ALCARECOSiPixelCalSingleMuonLoose.filter = True ##do not store empty events +ALCARECOSiPixelCalSingleMuonLoose.applyBasicCuts = True +ALCARECOSiPixelCalSingleMuonLoose.ptMin = 3.0 #GeV +ALCARECOSiPixelCalSingleMuonLoose.etaMin = -3.5 +ALCARECOSiPixelCalSingleMuonLoose.etaMax = 3.5 + +################################################################## +# Prescale events +################################################################## +import CalibTracker.SiStripCommon.prescaleEvent_cfi +scalerForSiPixelCalSingleMuonLoose = CalibTracker.SiStripCommon.prescaleEvent_cfi.prescaleEvent.clone(prescale = 100) + +################################################################## +# Loose Sequence +################################################################## +seqALCARECOSiPixelCalSingleMuonLoose = cms.Sequence(ALCARECOSiPixelCalSingleMuonLooseHLTFilter+ + scalerForSiPixelCalSingleMuonLoose+ + ALCARECOSiPixelCalSingleMuonLoose) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py new file mode 100644 index 0000000000000..3349e359c81b6 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOSiPixelCalSingleMuonTight_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOSiPixelCalSingleMuonTight') + ), + outputCommands = cms.untracked.vstring( + 'keep *_ALCARECOSiPixelCalSingleMuonTight_*_*', + 'keep *_muons__*', + 'keep *_offlinePrimaryVertices_*_*', + 'keep *_*riggerResults_*_HLT', + 'keep *_*closebyPixelClusters*_*_*', + 'keep *_*trackDistances*_*_*', + ) +) +OutALCARECOSiPixelCalSingleMuonTight=OutALCARECOSiPixelCalSingleMuonTight_noDrop.clone() +OutALCARECOSiPixelCalSingleMuonTight.outputCommands.insert(0, "drop *") diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py new file mode 100644 index 0000000000000..419e54fabe48e --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py @@ -0,0 +1,99 @@ +import FWCore.ParameterSet.Config as cms + +################################################################## +# AlCaReco for track based monitoring using single muon events +################################################################## +from HLTrigger.HLTfilters.hltHighLevel_cfi import * +ALCARECOSiPixelCalSingleMuonTightHLTFilter = hltHighLevel.clone() +ALCARECOSiPixelCalSingleMuonTightHLTFilter.andOr = True ## choose logical OR between Triggerbits +ALCARECOSiPixelCalSingleMuonTightHLTFilter.throw = False ## dont throw on unknown path names +ALCARECOSiPixelCalSingleMuonTightHLTFilter.HLTPaths = ["HLT_*"] +#ALCARECOSiPixelCalSingleMuonTightHLTFilter.eventSetupPathsKey = 'SiPixelCalSingleMuonTight' ## FIXME: to be changed once trigger bit is updated + +################################################################## +# Filter on the DCS partitions +################################################################## +import DPGAnalysis.Skims.skim_detstatus_cfi +ALCARECOSiPixelCalSingleMuonTightDCSFilter = DPGAnalysis.Skims.skim_detstatus_cfi.dcsstatus.clone( + DetectorType = cms.vstring('TIBTID','TOB','TECp','TECm','BPIX','FPIX', + 'DT0','DTp','DTm','CSCp','CSCm'), + ApplyFilter = cms.bool(True), + AndOr = cms.bool(True), + DebugOn = cms.untracked.bool(False) +) + +################################################################## +# Isolated muons Track selector +################################################################## +import Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi +ALCARECOSiPixelCalSingleMuonTightGoodMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlGoodIdMuonSelector.clone() +ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlRelCombIsoMuonSelector.clone( + src = 'ALCARECOSiPixelCalSingleMuonTightGoodMuons' +) + +################################################################## +# Basic Track selection +################################################################## +import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi +ALCARECOSiPixelCalSingleMuonTight = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone( + filter = True, ##do not store empty events + applyBasicCuts = True, + ptMin = 2.0, ##GeV + etaMin = -3.5, + etaMax = 3.5, + nHitMin = 0 +) + +################################################################## +# Muon selection +################################################################## +ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.muonSource = 'ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons' +# Isolation is shifted to the muon preselection, and then applied intrinsically if applyGlobalMuonFilter = True +ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.applyIsolationtest = False +ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.minJetDeltaR = 0.1 +ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.applyGlobalMuonFilter = True +ALCARECOSiPixelCalSingleMuonTight.TwoBodyDecaySelector.applyMassrangeFilter = False +ALCARECOSiPixelCalSingleMuonTight.TwoBodyDecaySelector.applyChargeFilter = False +ALCARECOSiPixelCalSingleMuonTight.TwoBodyDecaySelector.applyAcoplanarityFilter = False + +################################################################## +# Track refitter +################################################################## +from RecoVertex.BeamSpotProducer.BeamSpot_cff import * +#from RecoTracker.Configuration.RecoTrackerP5_cff import * +from RecoTracker.TrackProducer.TrackRefitter_cfi import * + +ALCARECOSiPixelCalSingleMuonTightTracksRefit = TrackRefitter.clone(src = cms.InputTag("ALCARECOSiPixelCalSingleMuonTight"), + NavigationSchool = cms.string("") + ) + +################################################################## +# Producer or close-by-pixels +################################################################## +import Calibration.TkAlCaRecoProducers.NearbyPixelClustersProducer_cfi as NearbyPixelClusters +closebyPixelClusters = NearbyPixelClusters.NearbyPixelClustersProducer.clone(clusterCollection = 'siPixelClusters', + trajectoryInput = 'ALCARECOSiPixelCalSingleMuonTightTracksRefit') + +################################################################## +# Sequence: track refit + close-by-pixel producer +################################################################## +ALCARECOSiPixelCalSingleMuonTightOffTrackClusters = cms.Sequence(ALCARECOSiPixelCalSingleMuonTightTracksRefit + + closebyPixelClusters) + +################################################################## +# Producer of distances value map +################################################################## +import Calibration.TkAlCaRecoProducers.TrackDistanceValueMapProducer_cfi as TrackDistanceValueMap +trackDistances = TrackDistanceValueMap.TrackDistanceValueMapProducer.clone(muonTracks = 'ALCARECOSiPixelCalSingleMuonTight') + +################################################################## +# Final Tight sequence +################################################################## +seqALCARECOSiPixelCalSingleMuonTight = cms.Sequence(offlineBeamSpot+ + ALCARECOSiPixelCalSingleMuonTightHLTFilter+ + ALCARECOSiPixelCalSingleMuonTightDCSFilter+ + ALCARECOSiPixelCalSingleMuonTightGoodMuons+ + ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons+ + ALCARECOSiPixelCalSingleMuonTight+ + trackDistances + + ALCARECOSiPixelCalSingleMuonTightOffTrackClusters) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_Output_cff.py index 6dfa18b1df673..81d4f66ed16fb 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_Output_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_Output_cff.py @@ -11,7 +11,6 @@ 'keep *_*riggerResults_*_HLT' ) ) -import copy -OutALCARECOSiPixelCalSingleMuon=copy.deepcopy(OutALCARECOSiPixelCalSingleMuon_noDrop) -OutALCARECOSiPixelCalSingleMuon.outputCommands.insert(0, "drop *") \ No newline at end of file +OutALCARECOSiPixelCalSingleMuon=OutALCARECOSiPixelCalSingleMuon_noDrop.clone() +OutALCARECOSiPixelCalSingleMuon.outputCommands.insert(0, "drop *") diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_cff.py index 70d4df13ffb22..53d634ca44b06 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuon_cff.py @@ -1,22 +1,26 @@ import FWCore.ParameterSet.Config as cms -import copy +################################################################## +# AlCaReco for track based calibration using single muon events +################################################################## from HLTrigger.HLTfilters.hltHighLevel_cfi import * -# AlCaReco for track based calibration using min. bias events -ALCARECOSiPixelCalSingleMuonHLTFilter = copy.deepcopy(hltHighLevel) -#seqALCARECOSiPixelCalSingleMuon = cms.Sequence(ALCARECOSiPixelCalSingleMuonHLTFilter) +ALCARECOSiPixelCalSingleMuonHLTFilter = hltHighLevel.clone() ALCARECOSiPixelCalSingleMuonHLTFilter.andOr = True ## choose logical OR between Triggerbits ALCARECOSiPixelCalSingleMuonHLTFilter.throw = False ## dont throw on unknown path names ALCARECOSiPixelCalSingleMuonHLTFilter.eventSetupPathsKey = 'SiPixelCalSingleMuon' +################################################################## +# Basic track selection +################################################################## import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi ALCARECOSiPixelCalSingleMuon = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone() - ALCARECOSiPixelCalSingleMuon.filter = True ##do not store empty events ALCARECOSiPixelCalSingleMuon.applyBasicCuts = True ALCARECOSiPixelCalSingleMuon.ptMin = 3.0 #GeV ALCARECOSiPixelCalSingleMuon.etaMin = -3.5 ALCARECOSiPixelCalSingleMuon.etaMax = 3.5 -# Sequence # +################################################################## +# Loose Sequence +################################################################## seqALCARECOSiPixelCalSingleMuon = cms.Sequence(ALCARECOSiPixelCalSingleMuonHLTFilter+ALCARECOSiPixelCalSingleMuon) diff --git a/Calibration/TkAlCaRecoProducers/python/NearbyPixelClustersProducer_cfi.py b/Calibration/TkAlCaRecoProducers/python/NearbyPixelClustersProducer_cfi.py new file mode 100644 index 0000000000000..51d715ef88874 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/NearbyPixelClustersProducer_cfi.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +NearbyPixelClustersProducer = cms.EDProducer('NearbyPixelClustersProducer', + clusterCollection = cms.InputTag('siPixelClusters'), # input clusters + trajectoryInput = cms.InputTag('TrackerRefitter'), # input trajectories + throwBadComponents = cms.bool(False), # do not use bad components + dumpWholeDetIds = cms.bool(False) # write all clusters in Det + ) diff --git a/Calibration/TkAlCaRecoProducers/python/TrackDistanceValueMapProducer_cfi.py b/Calibration/TkAlCaRecoProducers/python/TrackDistanceValueMapProducer_cfi.py new file mode 100644 index 0000000000000..5a136fe4285a6 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/TrackDistanceValueMapProducer_cfi.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +TrackDistanceValueMapProducer = cms.EDProducer('TrackDistanceValueMapProducer', + muonTracks = cms.InputTag('muonTracks'), # input muon tracks + allTracks = cms.InputTag('generalTracks'), # input generalTracks + saveUpToNthClosest = cms.uint32(1) # save only closest track + ) diff --git a/Calibration/TkAlCaRecoProducers/test/inspectNearByPixelClusters_cfg.py b/Calibration/TkAlCaRecoProducers/test/inspectNearByPixelClusters_cfg.py new file mode 100644 index 0000000000000..100c190906790 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/test/inspectNearByPixelClusters_cfg.py @@ -0,0 +1,95 @@ +import glob +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing +options = VarParsing.VarParsing() + +################################################################### +# Setup 'standard' options +################################################################### + +options.register('OutFileName', + "test.root", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "name of the output file (test.root is default)") + +options.register('myGT', + "auto:run2_data", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "name of the input Global Tag") + +options.register('maxEvents', + -1, + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "num. events to run") + +options.parseArguments() + +process = cms.Process("AlCaRECOAnalysis") + +################################################################### +# Message logger service +################################################################### +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.FwkReport.reportEvery = 1 + +################################################################### +# Geometry producer and standard includes +################################################################### +process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff") +process.load("Configuration.StandardSequences.Services_cff") +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load('Configuration.StandardSequences.MagneticField_cff') +#process.load("Configuration.StandardSequences.MagneticField_0T_cff") +process.load("CondCore.CondDB.CondDB_cfi") + +#################################################################### +# Get the GlogalTag +#################################################################### +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag,options.myGT, '') + +################################################################### +# Source +################################################################### +readFiles = cms.untracked.vstring() +readFiles.extend(['file:SiPixelCalSingleMuonTight.root']) +#readFiles.extend(['file:SiPixelCalSingleMuonTight_fullDetId.root']) +process.source = cms.Source("PoolSource",fileNames = readFiles) +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(options.maxEvents)) + +################################################################### +# The TrackRefitter +################################################################### +process.load("RecoTracker.TrackProducer.TrackRefitters_cff") +import RecoTracker.TrackProducer.TrackRefitters_cff +process.TrackRefitter = process.TrackRefitterP5.clone(src = 'ALCARECOSiPixelCalSingleMuonTight', + TrajectoryInEvent = True, + TTRHBuilder = "WithAngleAndTemplate", + NavigationSchool = "", + ) + +################################################################### +# The analysis module +################################################################### +process.myanalysis = cms.EDAnalyzer("NearbyPixelClustersAnalyzer", + trajectoryInput = cms.InputTag("TrackRefitter"), + #skimmedGeometryPath = cms.string("CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt") # phase-0 + skimmedGeometryPath = cms.string("SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt") #phase-1 + ) + +################################################################### +# Output name +################################################################### +process.TFileService = cms.Service("TFileService", + fileName = cms.string(options.OutFileName)) + +################################################################### +# Path +################################################################### +process.p1 = cms.Path(process.offlineBeamSpot* + process.TrackRefitter* + process.myanalysis) diff --git a/CondTools/Ecal/interface/EcalTPGOddWeightGroupHandler.h b/CondTools/Ecal/interface/EcalTPGOddWeightGroupHandler.h new file mode 100644 index 0000000000000..950e932f92b80 --- /dev/null +++ b/CondTools/Ecal/interface/EcalTPGOddWeightGroupHandler.h @@ -0,0 +1,95 @@ +#ifndef CONDTOOLS_ECAL_ECALTPGODDWEIGHTGROUPHANDLER_H +#define CONDTOOLS_ECAL_ECALTPGODDWEIGHTGROUPHANDLER_H + +#include +#include +#include +#include +#include +#include + +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/EventSetupRecordKey.h" + +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h" + +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/Oracle/interface/Oracle.h" +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" + +#include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/Provenance/interface/Timestamp.h" + +class EcalElectronicsMapping; + +namespace edm { + class ParameterSet; + class Event; + class EventSetup; +} // namespace edm + +namespace popcon { + + class EcalTPGOddWeightGroupHandler : public popcon::PopConSourceHandler { + public: + EcalTPGOddWeightGroupHandler(edm::ParameterSet const&); + ~EcalTPGOddWeightGroupHandler() override; + + std::map makeStripId(); + + void getNewObjects() override; + + std::string id() const override { return m_name; } + + void readtxtFile(); + void readxmlFile(); + + void readFromFile(const char* inputFile); + void writeFile(const char* inputFile); + + EcalCondDBInterface* econn; + + private: + std::string to_string(char value[]) { + std::ostringstream streamOut; + streamOut << value; + return streamOut.str(); + } + + unsigned int m_firstRun; + unsigned int m_lastRun; + + std::map correspId; + + const EcalElectronicsMapping* ecalMapping_; + std::string m_location; + std::string m_gentag; + std::string m_sid; + std::string m_user; + std::string m_pass; + std::string m_locationsource; + std::string m_name; + unsigned int m_runnr; + std::string m_runtype; + std::string m_i_tag; + std::string m_file_type; + std::string m_file_name; + int m_i_version; + unsigned int m_i_run_number; + int m_i_oddweightGroup; + }; +} // namespace popcon +#endif diff --git a/CondTools/Ecal/interface/EcalTPGOddWeightIdMapHandler.h b/CondTools/Ecal/interface/EcalTPGOddWeightIdMapHandler.h new file mode 100644 index 0000000000000..2a1d0f03a3549 --- /dev/null +++ b/CondTools/Ecal/interface/EcalTPGOddWeightIdMapHandler.h @@ -0,0 +1,90 @@ +#ifndef CONDTOOLS_ECAL_ECALTPGODDWEIGHTIDMAPHANDLER_H +#define CONDTOOLS_ECAL_ECALTPGODDWEIGHTIDMAPHANDLER_H + +#include +#include +#include +#include +#include +#include + +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/EventSetupRecordKey.h" + +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h" + +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/Oracle/interface/Oracle.h" +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" + +#include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/Provenance/interface/Timestamp.h" + +namespace edm { + class ParameterSet; + class Event; + class EventSetup; +} // namespace edm + +namespace popcon { + + class EcalTPGOddWeightIdMapHandler : public popcon::PopConSourceHandler { + public: + EcalTPGOddWeightIdMapHandler(edm::ParameterSet const&); + ~EcalTPGOddWeightIdMapHandler() override; + + void getNewObjects() override; + + std::string id() const override { return m_name; } + + void readtxtFile(); + void readxmlFile(); + + void readFromFile(const char* inputFile); + void writeFile(const char* inputFile); + + EcalCondDBInterface* econn; + + private: + std::string to_string(char value[]) { + std::ostringstream streamOut; + streamOut << value; + return streamOut.str(); + } + + const EcalTPGOddWeightIdMap* myweightIdMap; + + unsigned int m_firstRun; + unsigned int m_lastRun; + + std::string m_location; + std::string m_gentag; + std::string m_sid; + std::string m_user; + std::string m_pass; + std::string m_locationsource; + std::string m_name; + unsigned int m_runnr; + std::string m_runtype; + std::string m_i_tag; + std::string m_file_type; + std::string m_file_name; + int m_i_version; + unsigned int m_i_run_number; + int m_i_oddweightIdMap; + }; +} // namespace popcon +#endif diff --git a/CondTools/Ecal/interface/EcalTPGTPModeHandler.h b/CondTools/Ecal/interface/EcalTPGTPModeHandler.h new file mode 100644 index 0000000000000..c15dccb71d604 --- /dev/null +++ b/CondTools/Ecal/interface/EcalTPGTPModeHandler.h @@ -0,0 +1,88 @@ +#ifndef CONDTOOLS_ECAL_ECALTPGTPMODEHANDLER_H +#define CONDTOOLS_ECAL_ECALTPGTPMODEHANDLER_H + +#include +#include +#include +#include +#include +#include + +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/EventSetupRecordKey.h" + +#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" +#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h" + +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/Oracle/interface/Oracle.h" +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" + +#include "DataFormats/Provenance/interface/Timestamp.h" + +class EcalElectronicsMapping; + +namespace edm { + class ParameterSet; + class Event; + class EventSetup; +} // namespace edm + +namespace popcon { + + class EcalTPGTPModeHandler : public popcon::PopConSourceHandler { + public: + EcalTPGTPModeHandler(edm::ParameterSet const&); + ~EcalTPGTPModeHandler() override; + + void getNewObjects() override; + + std::string id() const override { return m_name; } + + void readtxtFile(); + // void readxmlFile(); + + void readFromFile(const char* inputFile); + void writeFile(const char* inputFile); + + EcalCondDBInterface* econn; + + private: + std::string to_string(char value[]) { + std::ostringstream streamOut; + streamOut << value; + return streamOut.str(); + } + + unsigned int m_firstRun; + unsigned int m_lastRun; + + std::string m_location; + std::string m_gentag; + std::string m_sid; + std::string m_user; + std::string m_pass; + std::string m_locationsource; + std::string m_name; + unsigned int m_runnr; + std::string m_runtype; + std::string m_i_tag; + std::string m_file_type; + std::string m_file_name; + int m_i_version; + unsigned int m_i_run_number; + int m_i_TPMode; + }; +} // namespace popcon +#endif diff --git a/CondTools/Ecal/python/copyTPMode_cfg.py b/CondTools/Ecal/python/copyTPMode_cfg.py new file mode 100644 index 0000000000000..022b4612e8c99 --- /dev/null +++ b/CondTools/Ecal/python/copyTPMode_cfg.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms +import CondTools.Ecal.conddb_init as conddb_init +import CondTools.Ecal.db_credentials as auth + +process = cms.Process("ProcessOne") + +process.MessageLogger = cms.Service("MessageLogger", + debugModules = cms.untracked.vstring('*'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('DEBUG') + ), + destinations = cms.untracked.vstring('cout') +) + + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(100000000), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(100000000), + interval = cms.uint64(1) +) + +process.load("CondCore.CondDB.CondDB_cfi") + +process.CondDB.connect = conddb_init.options.destinationDatabase +process.CondDB.DBParameters.authenticationPath = '' + +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + toPut = cms.VPSet(cms.PSet( + record = cms.string('EcalTPGTPModeRcd'), + tag = cms.string(conddb_init.options.destinationTag) + )) +) + +db_reader_account = 'CMS_ECAL_R' +db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account ) + +process.Test1 = cms.EDAnalyzer("ExTestEcalTPGTPModeAnalyzer", + record = cms.string('EcalTPGTPModeRcd'), + loggingOn= cms.untracked.bool(True), + IsDestDbCheckedInQueryLog=cms.untracked.bool(True), + SinceAppendMode=cms.bool(True), + Source=cms.PSet( + firstRun = cms.string('340400'), + lastRun = cms.string('10000000'), + OnlineDBSID = cms.string(db_service), + OnlineDBUser = cms.string(db_user), + OnlineDBPassword = cms.string( db_pwd ), + LocationSource = cms.string('P5'), + Location = cms.string('P5_Co'), + GenTag = cms.string('GLOBAL'), + RunType = cms.string('PHYSICS'), + fileType = cms.string(''), + fileName = cms.string('') + ) +) + +process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/python/copyWOddGroup_cfg.py b/CondTools/Ecal/python/copyWOddGroup_cfg.py new file mode 100644 index 0000000000000..302dc828e0881 --- /dev/null +++ b/CondTools/Ecal/python/copyWOddGroup_cfg.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms +import CondTools.Ecal.conddb_init as conddb_init +import CondTools.Ecal.db_credentials as auth + +process = cms.Process("ProcessOne") + +process.MessageLogger = cms.Service("MessageLogger", + debugModules = cms.untracked.vstring('*'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('DEBUG') + ), + destinations = cms.untracked.vstring('cout') +) + + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(100000000), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(100000000), + interval = cms.uint64(1) +) + +process.load("CondCore.CondDB.CondDB_cfi") + +process.CondDB.connect = conddb_init.options.destinationDatabase +process.CondDB.DBParameters.authenticationPath = '' + +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + toPut = cms.VPSet(cms.PSet( + record = cms.string('EcalTPGOddWeightGroupRcd'), + tag = cms.string(conddb_init.options.destinationTag) + )) +) + +db_reader_account = 'CMS_ECAL_R' +db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account ) + +process.Test1 = cms.EDAnalyzer("ExTestEcalTPGOddWeightGroupAnalyzer", + record = cms.string('EcalTPGOddWeightGroupRcd'), + loggingOn= cms.untracked.bool(True), + IsDestDbCheckedInQueryLog=cms.untracked.bool(True), + SinceAppendMode=cms.bool(True), + Source=cms.PSet( + firstRun = cms.string('340400'), + lastRun = cms.string('10000000'), + OnlineDBSID = cms.string(db_service), + OnlineDBUser = cms.string(db_user), + OnlineDBPassword = cms.string( db_pwd ), + LocationSource = cms.string('P5'), + Location = cms.string('P5_Co'), + GenTag = cms.string('GLOBAL'), + RunType = cms.string('PHYSICS'), + fileType = cms.string(''), + fileName = cms.string('') + ) +) + +process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/python/copyWOddIdMap_cfg.py b/CondTools/Ecal/python/copyWOddIdMap_cfg.py new file mode 100644 index 0000000000000..3464ebcbaf630 --- /dev/null +++ b/CondTools/Ecal/python/copyWOddIdMap_cfg.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms +import CondTools.Ecal.conddb_init as conddb_init +import CondTools.Ecal.db_credentials as auth + +process = cms.Process("ProcessOne") + +process.MessageLogger = cms.Service("MessageLogger", + debugModules = cms.untracked.vstring('*'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('DEBUG') + ), + destinations = cms.untracked.vstring('cout') +) + + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(100000000), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(100000000), + interval = cms.uint64(1) +) + +process.load("CondCore.CondDB.CondDB_cfi") + +process.CondDB.connect = conddb_init.options.destinationDatabase +process.CondDB.DBParameters.authenticationPath = '' + +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + toPut = cms.VPSet(cms.PSet( + record = cms.string('EcalTPGOddWeightIdMapRcd'), + tag = cms.string(conddb_init.options.destinationTag) + )) +) + +db_reader_account = 'CMS_ECAL_R' +db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account ) + +process.Test1 = cms.EDAnalyzer("ExTestEcalTPGOddWeightIdMapAnalyzer", + record = cms.string('EcalTPGOddWeightIdMapRcd'), + loggingOn= cms.untracked.bool(True), + IsDestDbCheckedInQueryLog=cms.untracked.bool(True), + SinceAppendMode=cms.bool(True), + Source=cms.PSet( + firstRun = cms.string('340400'), + lastRun = cms.string('10000000'), + OnlineDBSID = cms.string(db_service), + OnlineDBUser = cms.string(db_user), + OnlineDBPassword = cms.string( db_pwd ), + LocationSource = cms.string('P5'), + Location = cms.string('P5_Co'), + GenTag = cms.string('GLOBAL'), + RunType = cms.string('PHYSICS'), + fileType = cms.string(''), + fileName = cms.string('') + ) +) + +process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/src/EcalTPGOddWeightGroupHandler.cc b/CondTools/Ecal/src/EcalTPGOddWeightGroupHandler.cc new file mode 100644 index 0000000000000..ab3ea70e69ce1 --- /dev/null +++ b/CondTools/Ecal/src/EcalTPGOddWeightGroupHandler.cc @@ -0,0 +1,444 @@ +#include "CondTools/Ecal/interface/EcalLaserHandler.h" + +#include "CondTools/Ecal/interface/EcalTPGOddWeightGroupHandler.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" +#include "OnlineDB/EcalCondDB/interface/RunTPGConfigDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigSlidingInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigSlidingDat.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +#include +#include + +#include +#include + +#include +#include +#include +#include + +const Int_t kEBStrips = 12240, kEEStrips = 2936; + +popcon::EcalTPGOddWeightGroupHandler::EcalTPGOddWeightGroupHandler(const edm::ParameterSet& ps) + : m_name(ps.getUntrackedParameter("name", "EcalTPGOddWeightGroupHandler")) { + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "EcalTPGOddWeightGroup Source handler constructor."; + m_firstRun = static_cast(atoi(ps.getParameter("firstRun").c_str())); + m_lastRun = static_cast(atoi(ps.getParameter("lastRun").c_str())); + m_sid = ps.getParameter("OnlineDBSID"); + m_user = ps.getParameter("OnlineDBUser"); + m_pass = ps.getParameter("OnlineDBPassword"); + m_locationsource = ps.getParameter("LocationSource"); + m_location = ps.getParameter("Location"); + m_gentag = ps.getParameter("GenTag"); + m_runtype = ps.getParameter("RunType"); + m_file_type = ps.getParameter("fileType"); // xml/txt + m_file_name = ps.getParameter("fileName"); + + edm::LogInfo("EcalTPGOddWeightGroupHandler") << m_sid << "/" << m_user << "/" << m_location << "/" << m_gentag; +} + +popcon::EcalTPGOddWeightGroupHandler::~EcalTPGOddWeightGroupHandler() {} + +void popcon::EcalTPGOddWeightGroupHandler::getNewObjects() { + if (m_file_type == "txt") { + readtxtFile(); + } else if (m_file_type == "xml") { + readxmlFile(); + } else { + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "Started GetNewObjects!!!"; + + //check whats already inside of database + if (tagInfo().size) { + //check whats already inside of database + std::cout << "got offlineInfo = " << std::endl; + std::cout << "tag name = " << tagInfo().name << std::endl; + std::cout << "size = " << tagInfo().size << std::endl; + } else { + std::cout << " First object for this tag " << std::endl; + } + + unsigned int max_since = 0; + max_since = static_cast(tagInfo().lastInterval.since); + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "max_since : " << max_since; + + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "retrieved last payload "; + + // here we retrieve all the runs after the last from online DB + + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "Retrieving run list from ONLINE DB ... "; + + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "Making connection..."; + econn = new EcalCondDBInterface(m_sid, m_user, m_pass); + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "Done."; + + if (!econn) { + std::cout << " connection parameters " << m_sid << "/" << m_user << std::endl; + // cerr << e.what() << std::endl; + throw cms::Exception("OMDS not available"); + } + + LocationDef my_locdef; + my_locdef.setLocation(m_location); + + RunTypeDef my_rundef; + my_rundef.setRunType(m_runtype); + + RunTag my_runtag; + my_runtag.setLocationDef(my_locdef); + my_runtag.setRunTypeDef(my_rundef); + my_runtag.setGeneralTag(m_gentag); + + readFromFile("last_tpg_OddweightGroup_settings.txt"); + + unsigned int min_run = m_i_run_number + 1; + + if (m_firstRun < m_i_run_number) { + min_run = m_i_run_number + 1; + } else { + min_run = m_firstRun; + } + + if (min_run < max_since) { + min_run = max_since + 1; // we have to add 1 to the last transferred one + } + + std::cout << "m_i_run_number" << m_i_run_number << "m_firstRun " << m_firstRun << "max_since " << max_since + << std::endl; + + unsigned int max_run = m_lastRun; + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "min_run= " << min_run << " max_run= " << max_run; + + RunList my_list; + my_list = econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef); + // my_list=econn->fetchRunListByLocation(my_runtag,min_run,max_run,my_locdef); + + std::vector run_vec = my_list.getRuns(); + size_t num_runs = run_vec.size(); + + std::cout << "number of runs is : " << num_runs << std::endl; + + unsigned int irun = 0; + if (num_runs > 0) { + // going to query the ecal logic id + std::vector my_StripEcalLogicId_EE; + my_StripEcalLogicId_EE = + econn->getEcalLogicIDSetOrdered("ECAL_readout_strip", 1, 2000, 1, 70, 0, 5, "EE_offline_stripid", 123); + + std::cout << " GOT the logic ID for the EE trigger strips " << std::endl; + + for (size_t kr = 0; kr < run_vec.size(); kr++) { + irun = static_cast(run_vec[kr].getRunNumber()); + + std::cout << " **************** " << std::endl; + std::cout << " **************** " << std::endl; + std::cout << " run= " << irun << std::endl; + + // retrieve the data : + std::map dataset; + econn->fetchDataSet(&dataset, &run_vec[kr]); + + std::string the_config_tag = ""; + int the_config_version = 0; + + std::map::const_iterator it; + + int nr = 0; + for (it = dataset.begin(); it != dataset.end(); it++) { + ++nr; + //EcalLogicID ecalid = it->first; + + RunTPGConfigDat dat = it->second; + the_config_tag = dat.getConfigTag(); + the_config_version = dat.getVersion(); + } + + // it is all the same for all SM... get the last one + + std::cout << " run= " << irun << " tag " << the_config_tag << " version=" << the_config_version << std::endl; + + // here we should check if it is the same as previous run. + + if ((the_config_tag != m_i_tag || the_config_version != m_i_version) && nr > 0) { + std::cout << "the tag is different from last transferred run ... retrieving last config set from DB" + << std::endl; + + FEConfigMainInfo fe_main_info; + fe_main_info.setConfigTag(the_config_tag); + fe_main_info.setVersion(the_config_version); + + try { + std::cout << " before fetch config set" << std::endl; + econn->fetchConfigSet(&fe_main_info); + std::cout << " after fetch config set" << std::endl; + + // now get TPGOddWeightGroup + int wId = fe_main_info.getWei2Id(); + + if (wId != m_i_oddweightGroup) { + FEConfigOddWeightInfo fe_oddw_info; + fe_oddw_info.setId(wId); + econn->fetchConfigSet(&fe_oddw_info); + std::map dataset_TpgW; + econn->fetchDataSet(&dataset_TpgW, &fe_oddw_info); + + EcalTPGOddWeightGroup* weightG = new EcalTPGOddWeightGroup; + typedef std::map::const_iterator CIfesli; + EcalLogicID ecid_xt; + int weightGroup; + int icells = 0; + + std::map map; + std::string str; + + for (CIfesli p = dataset_TpgW.begin(); p != dataset_TpgW.end(); p++) { + ecid_xt = p->first; + weightGroup = p->second.getWeightGroupId(); + + std::string ecid_name = ecid_xt.getName(); + + // EB data + if (ecid_name == "EB_VFE") { + int sm = ecid_xt.getID1(); + int tt = ecid_xt.getID2(); + int strip = ecid_xt.getID3(); + int tcc = sm + 54; + if (sm > 18) + tcc = sm + 18; + + // simple formula to calculate the Srip EB identifier + + unsigned int stripEBId = 303176 + (tt - 1) * 64 + (strip - 1) * 8 + (tcc - 37) * 8192; + + weightG->setValue(stripEBId, weightGroup); + ++icells; + } else if (ecid_name == "ECAL_readout_strip") { + // EE data to add + int id1 = ecid_xt.getID1(); + int id2 = ecid_xt.getID2(); + int id3 = ecid_xt.getID3(); + + bool set_the_strip = false; + int stripEEId; + for (size_t istrip = 0; istrip < my_StripEcalLogicId_EE.size(); istrip++) { + if (!set_the_strip) { + if (my_StripEcalLogicId_EE[istrip].getID1() == id1 && + my_StripEcalLogicId_EE[istrip].getID2() == id2 && + my_StripEcalLogicId_EE[istrip].getID3() == id3) { + stripEEId = my_StripEcalLogicId_EE[istrip].getLogicID(); + set_the_strip = true; + break; + } + } + } + + if (set_the_strip) { + weightG->setValue(stripEEId, weightGroup); + + } else { + std::cout << " these may be the additional towers TCC/TT " << id1 << "/" << id2 << std::endl; + } + + ++icells; + } + } + + Time_t snc = (Time_t)irun; + + m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightGroup*)weightG, snc)); + + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + m_i_oddweightGroup = wId; + + writeFile("last_tpg_OddweightGroup_settings.txt"); + + } else { + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + + writeFile("last_tpg_OddweightGroup_settings.txt"); + + std::cout + << " even if the tag/version is not the same, the weight group id is the same -> no transfer needed " + << std::endl; + } + + } + + catch (std::exception& e) { + std::cout << "ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag + << " version=" << the_config_version << std::endl; + std::cout << e.what() << std::endl; + m_i_run_number = irun; + } + std::cout << " **************** " << std::endl; + + } else if (nr == 0) { + m_i_run_number = irun; + std::cout << " no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl; + std::cout << " **************** " << std::endl; + } else { + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + std::cout << " the tag/version is the same -> no transfer needed " << std::endl; + std::cout << " **************** " << std::endl; + writeFile("last_tpg_OddweightGroup_settings.txt"); + } + } + } + + delete econn; + } // usual way + edm::LogInfo("EcalTPGOddWeightGroupHandler") << "Ecal - > end of getNewObjects -----------"; +} + +void popcon::EcalTPGOddWeightGroupHandler::readtxtFile() { + std::cout << " reading the input file " << m_file_name << std::endl; + std::ifstream fInput; + fInput.open(m_file_name); + if (!fInput.is_open()) { + std::cout << "ERROR : cannot open file " << m_file_name << std::endl; + exit(1); + } + int weightGroup, stripEBId, stripEEId; + EcalTPGOddWeightGroup* weightG = new EcalTPGOddWeightGroup; + for (int strip = 0; strip < kEBStrips; strip++) { + fInput >> stripEBId >> weightGroup; + weightG->setValue(stripEBId, weightGroup); + } + for (int strip = 0; strip < kEEStrips; strip++) { + fInput >> stripEEId >> weightGroup; + weightG->setValue(stripEEId, weightGroup); + } + try { + Time_t snc = (Time_t)m_firstRun; + m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightGroup*)weightG, snc)); + } catch (std::exception& e) { + std::cout << "EcalTPGOddWeightGroupHandler::readtxtFile error : " << e.what() << std::endl; + } + std::cout << " **************** " << std::endl; +} + +void popcon::EcalTPGOddWeightGroupHandler::readxmlFile() { + std::cout << " reading the input file " << m_file_name << std::endl; + std::ifstream fxml; + fxml.open(m_file_name); + if (!fxml.is_open()) { + std::cout << "ERROR : cannot open file " << m_file_name << std::endl; + exit(1); + } + std::string dummyLine, bid; + int weightGroup, stripEBId, stripEEId; + EcalTPGOddWeightGroup* weightG = new EcalTPGOddWeightGroup; + for (int i = 0; i < 6; i++) + std::getline(fxml, dummyLine); // skip first lines + fxml >> bid; + // std::cout << bid << std::endl; + std::size_t found = bid.find("0 + for (int strip = 0; strip < kEBStrips; strip++) { + std::getline(fxml, dummyLine); // > bid; // > stripEBId; + std::getline(fxml, dummyLine); + fxml >> bid; // > weightGroup; + weightG->setValue(stripEBId, weightGroup); + for (int i = 0; i < 2; i++) + std::getline(fxml, dummyLine); // + } + for (int strip = 0; strip < kEEStrips; strip++) { + std::getline(fxml, dummyLine); // > bid; // > stripEEId; + std::getline(fxml, dummyLine); + fxml >> bid; // > weightGroup; + weightG->setValue(stripEEId, weightGroup); + for (int i = 0; i < 2; i++) + std::getline(fxml, dummyLine); // + } + try { + Time_t snc = (Time_t)m_firstRun; + m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightGroup*)weightG, snc)); + } catch (std::exception& e) { + std::cout << "EcalTPGOddWeightGroupHandler::readtxtFile error : " << e.what() << std::endl; + } + std::cout << " **************** " << std::endl; +} + +void popcon::EcalTPGOddWeightGroupHandler::readFromFile(const char* inputFile) { + //------------------------------------------------------------- + + m_i_tag = ""; + m_i_version = 0; + m_i_run_number = 0; + m_i_oddweightGroup = 0; + + FILE* inpFile; // input file + inpFile = fopen(inputFile, "r"); + if (!inpFile) { + edm::LogError("EcalTPGOddWeightGroupHandler") << "*** Can not open file: " << inputFile; + return; + } + + char line[256]; + + std::ostringstream str; + + fgets(line, 255, inpFile); + m_i_tag = to_string(line); + str << "gen tag " << m_i_tag << std::endl; // should I use this? + + fgets(line, 255, inpFile); + m_i_version = atoi(line); + str << "version= " << m_i_version << std::endl; + + fgets(line, 255, inpFile); + m_i_run_number = atoi(line); + str << "run_number= " << m_i_run_number << std::endl; + + fgets(line, 255, inpFile); + m_i_oddweightGroup = atoi(line); + str << "weightGroup_config= " << m_i_oddweightGroup << std::endl; + + fclose(inpFile); // close inp. file +} + +void popcon::EcalTPGOddWeightGroupHandler::writeFile(const char* inputFile) { + //------------------------------------------------------------- + + std::ofstream myfile; + myfile.open(inputFile); + myfile << m_i_tag << std::endl; + myfile << m_i_version << std::endl; + myfile << m_i_run_number << std::endl; + myfile << m_i_oddweightGroup << std::endl; + + myfile.close(); +} diff --git a/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc b/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc new file mode 100644 index 0000000000000..f744a85bd144e --- /dev/null +++ b/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc @@ -0,0 +1,392 @@ +#include "CondTools/Ecal/interface/EcalLaserHandler.h" + +#include "CondTools/Ecal/interface/EcalTPGOddWeightIdMapHandler.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" +#include "OnlineDB/EcalCondDB/interface/RunTPGConfigDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigWeightInfo.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include + +#include +#include + +#include +#include +#include +#include + +popcon::EcalTPGOddWeightIdMapHandler::EcalTPGOddWeightIdMapHandler(const edm::ParameterSet& ps) + : m_name(ps.getUntrackedParameter("name", "EcalTPGOddWeightIdMapHandler")) { + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "EcalTPGOddWeightIdMap Source handler constructor"; + m_firstRun = static_cast(atoi(ps.getParameter("firstRun").c_str())); + m_lastRun = static_cast(atoi(ps.getParameter("lastRun").c_str())); + m_sid = ps.getParameter("OnlineDBSID"); + m_user = ps.getParameter("OnlineDBUser"); + m_pass = ps.getParameter("OnlineDBPassword"); + m_locationsource = ps.getParameter("LocationSource"); + m_location = ps.getParameter("Location"); + m_gentag = ps.getParameter("GenTag"); + m_runtype = ps.getParameter("RunType"); + m_file_type = ps.getParameter("fileType"); // xml/txt + m_file_name = ps.getParameter("fileName"); + + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << m_sid << "/" << m_user << "/" << m_location << "/" << m_gentag; +} + +popcon::EcalTPGOddWeightIdMapHandler::~EcalTPGOddWeightIdMapHandler() {} + +void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { + if (m_file_type == "txt") { + readtxtFile(); + } else if (m_file_type == "xml") { + readxmlFile(); + } else { + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Started GetNewObjects!!!"; + + //check whats already inside of database + if (tagInfo().size) { + //check whats already inside of database + std::cout << "got offlineInfo = " << std::endl; + std::cout << "tag name = " << tagInfo().name << std::endl; + std::cout << "size = " << tagInfo().size << std::endl; + } else { + std::cout << " First object for this tag " << std::endl; + } + + unsigned int max_since = 0; + max_since = static_cast(tagInfo().lastInterval.since); + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "max_since : " << max_since; + //Ref weightIdMap_db = lastPayload(); + + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "retrieved last payload "; + + // here we retrieve all the runs after the last from online DB + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Retrieving run list from ONLINE DB ... "; + + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Making connection..."; + econn = new EcalCondDBInterface(m_sid, m_user, m_pass); + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Done."; + + if (!econn) { + std::cout << " connection parameters " << m_sid << "/" << m_user << std::endl; + // cerr << e.what() << std::endl; + throw cms::Exception("OMDS not available"); + } + + LocationDef my_locdef; + my_locdef.setLocation(m_location); + + RunTypeDef my_rundef; + my_rundef.setRunType(m_runtype); + + RunTag my_runtag; + my_runtag.setLocationDef(my_locdef); + my_runtag.setRunTypeDef(my_rundef); + my_runtag.setGeneralTag(m_gentag); + + readFromFile("last_tpg_OddweightIdMap_settings.txt"); + + unsigned int min_run = m_i_run_number + 1; + + if (m_firstRun < m_i_run_number) { + min_run = m_i_run_number + 1; + } else { + min_run = m_firstRun; + } + + if (min_run < max_since) { + min_run = max_since + 1; // we have to add 1 to the last transferred one + } + + std::cout << "m_i_run_number" << m_i_run_number << "m_firstRun " << m_firstRun << "max_since " << max_since + << std::endl; + + unsigned int max_run = m_lastRun; + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "min_run= " << min_run << "max_run= " << max_run; + + RunList my_list; + my_list = econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef); + // my_list=econn->fetchRunListByLocation(my_runtag,min_run,max_run,my_locdef); + + std::vector run_vec = my_list.getRuns(); + size_t num_runs = run_vec.size(); + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "number of Mon runs is : " << num_runs; + + unsigned int irun; + if (num_runs > 0) { + for (size_t kr = 0; kr < run_vec.size(); kr++) { + irun = static_cast(run_vec[kr].getRunNumber()); + + std::cout << " **************** " << std::endl; + std::cout << " **************** " << std::endl; + std::cout << " run= " << irun << std::endl; + + // retrieve the data : + std::map dataset; + econn->fetchDataSet(&dataset, &run_vec[kr]); + + std::string the_config_tag = ""; + int the_config_version = 0; + + std::map::const_iterator it; + + int nr = 0; + for (it = dataset.begin(); it != dataset.end(); it++) { + ++nr; + //EcalLogicID ecalid = it->first; + RunTPGConfigDat dat = it->second; + the_config_tag = dat.getConfigTag(); + the_config_version = dat.getVersion(); + } + + // it is all the same for all SM... get the last one + + std::cout << " run= " << irun << " tag " << the_config_tag << " version=" << the_config_version << std::endl; + + // here we should check if it is the same as previous run. + + if ((the_config_tag != m_i_tag || the_config_version != m_i_version) && nr > 0) { + std::cout << "the tag is different from last transferred run ... retrieving last config set from DB" + << std::endl; + + FEConfigMainInfo fe_main_info; + fe_main_info.setConfigTag(the_config_tag); + fe_main_info.setVersion(the_config_version); + + try { + std::cout << " before fetch config set" << std::endl; + econn->fetchConfigSet(&fe_main_info); + std::cout << " after fetch config set" << std::endl; + + // now get TPGOddWeightIdMap + int weightId = fe_main_info.getWei2Id(); + + if (weightId != m_i_oddweightIdMap) { + FEConfigOddWeightInfo fe_odd_weight_info; + fe_odd_weight_info.setId(weightId); + econn->fetchConfigSet(&fe_odd_weight_info); + std::map dataset_TpgWeight; + econn->fetchDataSet(&dataset_TpgWeight, &fe_odd_weight_info); + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Got object!"; + EcalTPGOddWeightIdMap* weightMap = new EcalTPGOddWeightIdMap; + typedef std::map::const_iterator CIfeweight; + EcalLogicID ecid_xt; + FEConfigOddWeightGroupDat rd_w; + + int igroups = 0; + for (CIfeweight p = dataset_TpgWeight.begin(); p != dataset_TpgWeight.end(); p++) { + rd_w = p->second; + // EB and EE data + EcalTPGWeights w; + unsigned int weight0 = static_cast(rd_w.getWeight4()); + unsigned int weight1 = static_cast(rd_w.getWeight3()); + unsigned int weight2 = static_cast(rd_w.getWeight2()); + unsigned int weight3 = static_cast(rd_w.getWeight1() - 0x80); + unsigned int weight4 = static_cast(rd_w.getWeight0()); + + w.setValues(weight0, weight1, weight2, weight3, weight4); + weightMap->setValue(rd_w.getWeightGroupId(), w); + + ++igroups; + } + + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "found " << igroups << "Weight groups"; + + Time_t snc = (Time_t)irun; + m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightIdMap*)weightMap, snc)); + + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + m_i_oddweightIdMap = weightId; + + writeFile("last_tpg_OddweightIdMap_settings.txt"); + + } else { + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + + writeFile("last_tpg_OddweightIdMap_settings.txt"); + + std::cout + << " even if the tag/version is not the same, the weightIdMap id is the same -> no transfer needed " + << std::endl; + } + + } catch (std::exception& e) { + std::cout << "ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag + << " version=" << the_config_version << std::endl; + std::cout << e.what() << std::endl; + m_i_run_number = irun; + } + std::cout << " **************** " << std::endl; + + } else if (nr == 0) { + m_i_run_number = irun; + std::cout << " no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl; + std::cout << " **************** " << std::endl; + } else { + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + std::cout << " the tag/version is the same -> no transfer needed " << std::endl; + std::cout << " **************** " << std::endl; + writeFile("last_tpg_OddweightIdMap_settings.txt"); + } + } + } + + delete econn; + } // usual way + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Ecal - > end of getNewObjects -----------"; +} +void popcon::EcalTPGOddWeightIdMapHandler::readtxtFile() { + std::cout << " reading the input file " << m_file_name << std::endl; + std::ifstream fInput; + fInput.open(m_file_name); + if (!fInput.is_open()) { + std::cout << "ERROR : cannot open file " << m_file_name << std::endl; + exit(1); + } + unsigned int wloc[5]; + EcalTPGWeights w; + EcalTPGOddWeightIdMap* weightMap = new EcalTPGOddWeightIdMap; + int igroups = 0; + std::string line; + while (!fInput.eof()) { + getline(fInput, line); + if (!line.empty()) { + std::stringstream ss; + ss << line; + ss >> wloc[0] >> wloc[1] >> wloc[2] >> wloc[3] >> wloc[4]; + // std::cout << wloc[0] << " " << wloc[1] << " " << wloc[2] << " " << wloc[3] << " " << wloc[4] << std::endl; + w.setValues(wloc[0], wloc[1], wloc[2], wloc[3], wloc[4]); + weightMap->setValue(igroups, w); + igroups++; + } + } + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "found " << igroups << " Weight groups"; + try { + Time_t snc = (Time_t)m_firstRun; + m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightIdMap*)weightMap, snc)); + } catch (std::exception& e) { + std::cout << "EcalTPGOddWeightIdMapHandler::readtxtFile error : " << e.what() << std::endl; + } + std::cout << " **************** " << std::endl; +} + +void popcon::EcalTPGOddWeightIdMapHandler::readxmlFile() { + std::cout << " reading the input file " << m_file_name << std::endl; + std::ifstream fxml; + fxml.open(m_file_name); + if (!fxml.is_open()) { + std::cout << "ERROR : cannot open file " << m_file_name << std::endl; + exit(1); + } + std::string dummyLine, bid; + unsigned int wloc[5]; + EcalTPGWeights w; + EcalTPGOddWeightIdMap* weightMap = new EcalTPGOddWeightIdMap; + int ngroups, igroups; + for (int i = 0; i < 5; i++) + std::getline(fxml, dummyLine); // skip first lines + // get the Weight group number + fxml >> bid; + std::string stt = bid.substr(7, 1); + std::istringstream sc(stt); + sc >> ngroups; + edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "found " << ngroups << " Weight groups"; + for (int i = 0; i < 2; i++) + std::getline(fxml, dummyLine); // 0 + // std::cout << dummyLine << std::endl; + for (int i = 0; i < ngroups; i++) { + std::getline(fxml, dummyLine); // > bid; // > igroups; + if (igroups != i) { + std::cout << " group " << i << ": " << bid << " igroups " << igroups << std::endl; + exit(-1); + } + for (int i = 0; i < 2; i++) + std::getline(fxml, dummyLine); // < second + for (int i = 0; i < 5; i++) { + fxml >> bid; + found = bid.find("> wloc[i]; + } + w.setValues(wloc[0], wloc[1], wloc[2], wloc[3], wloc[4]); + weightMap->setValue(igroups, w); + for (int i = 0; i < 3; i++) + std::getline(fxml, dummyLine); // + // std::cout << " group " << i << " last line " << dummyLine << std::endl; + } + try { + Time_t snc = (Time_t)m_firstRun; + m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightIdMap*)weightMap, snc)); + } catch (std::exception& e) { + std::cout << "EcalTPGOddWeightIdMapHandler::readxmlFile error : " << e.what() << std::endl; + } + std::cout << " **************** " << std::endl; +} + +void popcon::EcalTPGOddWeightIdMapHandler::readFromFile(const char* inputFile) { + //------------------------------------------------------------- + + m_i_tag = ""; + m_i_version = 0; + m_i_run_number = 0; + m_i_oddweightIdMap = 0; + + FILE* inpFile; // input file + inpFile = fopen(inputFile, "r"); + if (!inpFile) { + edm::LogError("EcalTPGOddWeightIdMapHandler") << "*** Can not open file: " << inputFile; + return; + } + + char line[256]; + + std::ostringstream str; + + fgets(line, 255, inpFile); + m_i_tag = to_string(line); + str << "gen tag " << m_i_tag << std::endl; // should I use this? + + fgets(line, 255, inpFile); + m_i_version = atoi(line); + str << "version= " << m_i_version << std::endl; + + fgets(line, 255, inpFile); + m_i_run_number = atoi(line); + str << "run_number= " << m_i_run_number << std::endl; + + fgets(line, 255, inpFile); + m_i_oddweightIdMap = atoi(line); + str << "weightIdMap_config= " << m_i_oddweightIdMap << std::endl; + + fclose(inpFile); // close inp. file +} + +void popcon::EcalTPGOddWeightIdMapHandler::writeFile(const char* inputFile) { + //------------------------------------------------------------- + + std::ofstream myfile; + myfile.open(inputFile); + myfile << m_i_tag << std::endl; + myfile << m_i_version << std::endl; + myfile << m_i_run_number << std::endl; + myfile << m_i_oddweightIdMap << std::endl; + + myfile.close(); +} diff --git a/CondTools/Ecal/src/EcalTPGTPModeHandler.cc b/CondTools/Ecal/src/EcalTPGTPModeHandler.cc new file mode 100644 index 0000000000000..869f6aa6ec1e9 --- /dev/null +++ b/CondTools/Ecal/src/EcalTPGTPModeHandler.cc @@ -0,0 +1,388 @@ +#include "CondTools/Ecal/interface/EcalLaserHandler.h" + +#include "CondTools/Ecal/interface/EcalTPGTPModeHandler.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" +#include "OnlineDB/EcalCondDB/interface/RunTPGConfigDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigSlidingInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigSlidingDat.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +popcon::EcalTPGTPModeHandler::EcalTPGTPModeHandler(const edm::ParameterSet& ps) + : m_name(ps.getUntrackedParameter("name", "EcalTPGTPModeHandler")) { + edm::LogInfo("EcalTPGTPModeHandler") << "Ecal TPG TPMode Source handler constructor."; + m_firstRun = static_cast(atoi(ps.getParameter("firstRun").c_str())); + m_lastRun = static_cast(atoi(ps.getParameter("lastRun").c_str())); + m_sid = ps.getParameter("OnlineDBSID"); + m_user = ps.getParameter("OnlineDBUser"); + m_pass = ps.getParameter("OnlineDBPassword"); + m_locationsource = ps.getParameter("LocationSource"); + m_location = ps.getParameter("Location"); + m_gentag = ps.getParameter("GenTag"); + m_runtype = ps.getParameter("RunType"); + m_file_type = ps.getParameter("fileType"); // xml/txt + m_file_name = ps.getParameter("fileName"); + + edm::LogInfo("EcalTPGTPModeHandler") << m_sid << "/" << m_user << "/" << m_location << "/" << m_gentag; +} + +popcon::EcalTPGTPModeHandler::~EcalTPGTPModeHandler() {} + +void popcon::EcalTPGTPModeHandler::getNewObjects() { + if (m_file_type == "txt") { + readtxtFile(); + } + // else if(m_file_type == "xml") { + // readxmlFile(); + // } + else { + edm::LogInfo("EcalTPGTPModeHandler") << "Started GetNewObjects!!!"; + + //check whats already inside of database + if (tagInfo().size) { + //check whats already inside of database + std::cout << "got offlineInfo = " << std::endl; + std::cout << "tag name = " << tagInfo().name << std::endl; + std::cout << "size = " << tagInfo().size << std::endl; + } else { + std::cout << " First object for this tag " << std::endl; + } + + unsigned int max_since = 0; + max_since = static_cast(tagInfo().lastInterval.since); + edm::LogInfo("EcalTPGTPModeHandler") << "max_since : " << max_since; + + edm::LogInfo("EcalTPGTPModeHandler") << "retrieved last payload "; + + // here we retrieve all the runs after the last from online DB + + edm::LogInfo("EcalTPGTPModeHandler") << "Retrieving run list from ONLINE DB ... "; + + edm::LogInfo("EcalTPGTPModeHandler") << "Making connection..."; + econn = new EcalCondDBInterface(m_sid, m_user, m_pass); + edm::LogInfo("EcalTPGTPModeHandler") << "Done."; + + if (!econn) { + std::cout << " connection parameters " << m_sid << "/" << m_user << std::endl; + // cerr << e.what() << std::endl; + throw cms::Exception("OMDS not available"); + } + + LocationDef my_locdef; + my_locdef.setLocation(m_location); + + RunTypeDef my_rundef; + my_rundef.setRunType(m_runtype); + + RunTag my_runtag; + my_runtag.setLocationDef(my_locdef); + my_runtag.setRunTypeDef(my_rundef); + my_runtag.setGeneralTag(m_gentag); + + readFromFile("last_tpg_TPMode_settings.txt"); + + unsigned int min_run = m_i_run_number + 1; + + if (m_firstRun < m_i_run_number) { + min_run = m_i_run_number + 1; + } else { + min_run = m_firstRun; + } + + if (min_run < max_since) { + min_run = max_since + 1; // we have to add 1 to the last transferred one + } + + std::cout << "m_i_run_number" << m_i_run_number << "m_firstRun " << m_firstRun << "max_since " << max_since + << std::endl; + + unsigned int max_run = m_lastRun; + edm::LogInfo("EcalTPGTPModeHandler") << "min_run= " << min_run << " max_run= " << max_run; + + RunList my_list; + my_list = econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef); + // my_list=econn->fetchRunListByLocation(my_runtag,min_run,max_run,my_locdef); + + std::vector run_vec = my_list.getRuns(); + size_t num_runs = run_vec.size(); + + std::cout << "number of runs is : " << num_runs << std::endl; + + unsigned int irun = 0; + if (num_runs > 0) { + for (size_t kr = 0; kr < run_vec.size(); kr++) { + irun = static_cast(run_vec[kr].getRunNumber()); + + std::cout << " **************** " << std::endl; + std::cout << " **************** " << std::endl; + std::cout << " run= " << irun << std::endl; + + // retrieve the data : + std::map dataset; + econn->fetchDataSet(&dataset, &run_vec[kr]); + + std::string the_config_tag = ""; + int the_config_version = 0; + + std::map::const_iterator it; + + int nr = 0; + for (it = dataset.begin(); it != dataset.end(); it++) { + ++nr; + EcalLogicID ecalid = it->first; + RunTPGConfigDat dat = it->second; + the_config_tag = dat.getConfigTag(); + the_config_version = dat.getVersion(); + } + + // it is all the same for all SM... get the last one + + std::cout << " run= " << irun << " tag " << the_config_tag << " version=" << the_config_version << std::endl; + + // here we should check if it is the same as previous run. + + if ((the_config_tag != m_i_tag || the_config_version != m_i_version) && nr > 0) { + std::cout << "the tag is different from last transferred run ... retrieving last config set from DB" + << std::endl; + + FEConfigMainInfo fe_main_info; + fe_main_info.setConfigTag(the_config_tag); + fe_main_info.setVersion(the_config_version); + + try { + std::cout << " before fetch config set" << std::endl; + econn->fetchConfigSet(&fe_main_info); + std::cout << " after fetch config set" << std::endl; + + // now get TPGTPMode + int wId = fe_main_info.getWei2Id(); + if (wId != m_i_TPMode) { + FEConfigOddWeightInfo fe_odd_weight_info; + fe_odd_weight_info.setId(wId); + econn->fetchConfigSet(&fe_odd_weight_info); + std::map dataset_mode; + econn->fetchDataSet(&dataset_mode, &fe_odd_weight_info); + + typedef std::map::const_iterator CIfem; + FEConfigOddWeightModeDat rd_mode; + + int rd_modev[19] = {0}; + int k = 0; + for (CIfem p = dataset_mode.begin(); p != dataset_mode.end(); p++) { + rd_mode = p->second; + rd_modev[0] = rd_mode.getEnableEBOddFilter(); + rd_modev[1] = rd_mode.getEnableEEOddFilter(); + rd_modev[2] = rd_mode.getEnableEBOddPeakFinder(); + rd_modev[3] = rd_mode.getEnableEEOddPeakFinder(); + rd_modev[4] = rd_mode.getDisableEBEvenPeakFinder(); + rd_modev[5] = rd_mode.getDisableEEEvenPeakFinder(); + rd_modev[6] = rd_mode.getFenixEBStripOutput(); + rd_modev[7] = rd_mode.getFenixEEStripOutput(); + rd_modev[8] = rd_mode.getFenixEBStripInfobit2(); + rd_modev[9] = rd_mode.getFenixEEStripInfobit2(); + rd_modev[10] = rd_mode.getFenixEBTcpOutput(); + rd_modev[11] = rd_mode.getFenixEBTcpInfobit1(); + rd_modev[12] = rd_mode.getFenixEETcpOutput(); + rd_modev[13] = rd_mode.getFenixEETcpInfobit1(); + // ... + std::cout << "here is the value for the weight mode: " << std::endl + << " EnableEBOddFilter:" << rd_modev[0] << std::endl + << " EnableEEOddFilter:" << rd_modev[1] << std::endl + << " EnableEBOddPeakFinder:" << rd_modev[2] << std::endl + << " EnableEEOddPeakFinder:" << rd_modev[3] << std::endl + << " DisableEBEvenPeakFinder:" << rd_modev[4] << std::endl + << " DisableEEEvenPeakFinder:" << rd_modev[5] << std::endl + << " FenixEBStripOutput:" << rd_modev[6] << std::endl + << " FenixEEStripOutput:" << rd_modev[7] << std::endl + << " FenixEBStripInfobit2:" << rd_modev[8] << std::endl + << " FenixEEStripInfobit2:" << rd_modev[9] << std::endl + << " FenixEBTcpOutput:" << rd_modev[10] << std::endl + << " FenixEBTcpinfobit1:" << rd_modev[11] << std::endl + << " FenixEETcpOutput:" << rd_modev[12] << std::endl + << " FenixEETcpinfobit1:" << rd_modev[13] << std::endl; + k = k + 1; + } + + std::cout << "*****************************************" << std::endl; + std::cout << "read done " << wId << std::endl; + std::cout << "*****************************************" << std::endl; + + EcalTPGTPMode* tpMode = new EcalTPGTPMode; + tpMode->EnableEBOddFilter = rd_modev[0]; + tpMode->EnableEEOddFilter = rd_modev[1]; + tpMode->EnableEBOddPeakFinder = rd_modev[2]; + tpMode->EnableEEOddPeakFinder = rd_modev[3]; + tpMode->DisableEBEvenPeakFinder = rd_modev[4]; + tpMode->DisableEEEvenPeakFinder = rd_modev[5]; + tpMode->FenixEBStripOutput = rd_modev[6]; + tpMode->FenixEEStripOutput = rd_modev[7]; + tpMode->FenixEBStripInfobit2 = rd_modev[8]; + tpMode->FenixEEStripInfobit2 = rd_modev[9]; + tpMode->EBFenixTcpOutput = rd_modev[10]; + tpMode->EBFenixTcpInfobit1 = rd_modev[11]; + tpMode->EEFenixTcpOutput = rd_modev[12]; + tpMode->EEFenixTcpInfobit1 = rd_modev[13]; + tpMode->FenixPar15 = 0; + tpMode->FenixPar16 = 0; + tpMode->FenixPar17 = 0; + tpMode->FenixPar18 = 0; + Time_t snc = (Time_t)irun; + m_to_transfer.push_back(std::make_pair((EcalTPGTPMode*)tpMode, snc)); + + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + m_i_TPMode = wId; + + writeFile("last_tpg_TPMode_settings.txt"); + + } else { + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + + writeFile("last_tpg_TPMode_settings.txt"); + + std::cout + << " even if the tag/version is not the same, the weight group id is the same -> no transfer needed " + << std::endl; + } + + } + + catch (std::exception& e) { + std::cout << "ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag + << " version=" << the_config_version << std::endl; + std::cout << e.what() << std::endl; + m_i_run_number = irun; + } + std::cout << " **************** " << std::endl; + + } else if (nr == 0) { + m_i_run_number = irun; + std::cout << " no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl; + std::cout << " **************** " << std::endl; + } else { + m_i_run_number = irun; + m_i_tag = the_config_tag; + m_i_version = the_config_version; + std::cout << " the tag/version is the same -> no transfer needed " << std::endl; + std::cout << " **************** " << std::endl; + writeFile("last_tpg_TPMode_settings.txt"); + } + } + } + + delete econn; + } // usual way + edm::LogInfo("EcalTPGTPModeHandler") << "Ecal - > end of getNewObjects -----------"; +} + +void popcon::EcalTPGTPModeHandler::readtxtFile() { + std::cout << " reading the input file " << m_file_name << std::endl; + std::ifstream fInput; + fInput.open(m_file_name); + if (!fInput.is_open()) { + std::cout << "ERROR : cannot open file " << m_file_name << std::endl; + exit(1); + } + std::map values; + EcalTPGTPMode* tpMode = new EcalTPGTPMode; + + std::string key; + int value; + while (fInput.good()) { + fInput >> key >> value; + values[key] = value; + } + + try { + tpMode->EnableEBOddFilter = values["EnableEBOddFilter"]; + tpMode->EnableEEOddFilter = values["EnableEEOddFilter"]; + tpMode->EnableEBOddPeakFinder = values["EnableEBOddPeakFinder"]; + tpMode->EnableEEOddPeakFinder = values["EnableEEOddPeakFinder"]; + tpMode->DisableEBEvenPeakFinder = values["DisableEBEvenPeakFinder"]; + tpMode->DisableEEEvenPeakFinder = values["DisableEEEvenPeakFinder"]; + tpMode->FenixEBStripOutput = values["FenixEBStripOutput"]; + tpMode->FenixEEStripOutput = values["FenixEEStripOutput"]; + tpMode->FenixEBStripInfobit2 = values["FenixEBStripInfobit2"]; + tpMode->FenixEEStripInfobit2 = values["FenixEEStripInfobit2"]; + tpMode->EBFenixTcpOutput = values["EBFenixTcpOutput"]; + tpMode->EBFenixTcpInfobit1 = values["EBFenixTcpInfobit1"]; + tpMode->EEFenixTcpOutput = values["EEFenixTcpOutput"]; + tpMode->EEFenixTcpInfobit1 = values["EEFenixTcpInfobit1"]; + + Time_t snc = (Time_t)m_firstRun; + m_to_transfer.push_back(std::make_pair((EcalTPGTPMode*)tpMode, snc)); + + } catch (std::exception& e) { + std::cout << "EcalTPGTPModeHandler::readtxtFile error : " << e.what() << std::endl; + } + std::cout << " **************** " << std::endl; +} + +void popcon::EcalTPGTPModeHandler::readFromFile(const char* inputFile) { + //------------------------------------------------------------- + + m_i_tag = ""; + m_i_version = 0; + m_i_run_number = 0; + m_i_TPMode = 0; + + FILE* inpFile; // input file + inpFile = fopen(inputFile, "r"); + if (!inpFile) { + edm::LogError("EcalTPGTPModeHandler") << "*** Can not open file: " << inputFile; + return; + } + + char line[256]; + + std::ostringstream str; + + fgets(line, 255, inpFile); + m_i_tag = to_string(line); + str << "gen tag " << m_i_tag << std::endl; // should I use this? + + fgets(line, 255, inpFile); + m_i_version = atoi(line); + str << "version= " << m_i_version << std::endl; + + fgets(line, 255, inpFile); + m_i_run_number = atoi(line); + str << "run_number= " << m_i_run_number << std::endl; + + fgets(line, 255, inpFile); + m_i_TPMode = atoi(line); + str << "TPMode_config= " << m_i_TPMode << std::endl; + + fclose(inpFile); // close inp. file +} + +void popcon::EcalTPGTPModeHandler::writeFile(const char* inputFile) { + //------------------------------------------------------------- + + std::ofstream myfile; + myfile.open(inputFile); + myfile << m_i_tag << std::endl; + myfile << m_i_version << std::endl; + myfile << m_i_run_number << std::endl; + myfile << m_i_TPMode << std::endl; + + myfile.close(); +} diff --git a/Configuration/AlCa/python/autoAlca.py b/Configuration/AlCa/python/autoAlca.py index b66b54bdcc6d5..4f3dac82fca6b 100644 --- a/Configuration/AlCa/python/autoAlca.py +++ b/Configuration/AlCa/python/autoAlca.py @@ -12,7 +12,7 @@ "MuOnia" : "TkAlUpsilonMuMu", "NoBPTX" : "TkAlCosmicsInCollisions", "SingleElectron" : "EcalUncalWElectron+EcalUncalZElectron+HcalCalIterativePhiSym+EcalESAlign", - "SingleMuon" : "SiPixelCalSingleMuon+TkAlMuonIsolated+MuAlCalIsolatedMu+MuAlOverlaps+MuAlZMuMu+HcalCalHO+HcalCalIterativePhiSym+HcalCalHBHEMuonFilter+HcalCalHEMuonFilter", + "SingleMuon" : "SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+TkAlMuonIsolated+MuAlCalIsolatedMu+MuAlOverlaps+MuAlZMuMu+HcalCalHO+HcalCalIterativePhiSym+HcalCalHBHEMuonFilter+HcalCalHEMuonFilter", "SinglePhoton" : "HcalCalGammaJet", "ZeroBias" : "SiStripCalZeroBias+TkAlMinBias+LumiPixelsMinBias+SiStripCalMinBias+AlCaPCCZeroBiasFromRECO", @@ -96,7 +96,7 @@ 'MuOnia' : 'TkAlUpsilonMuMu', 'SingleElectron' : 'EcalUncalWElectron+EcalUncalZElectron+EcalESAlign+HcalCalIterativePhiSym+HcalCalIsoTrkFilter', 'SingleMu' : 'MuAlCalIsolatedMu+MuAlOverlaps+TkAlMuonIsolated+MuAlZMuMu+HcalCalHO', - 'SingleMuon' : 'SiPixelCalSingleMuon+TkAlMuonIsolated+MuAlCalIsolatedMu+MuAlOverlaps+MuAlZMuMu+HcalCalIterativePhiSym+HcalCalHO', + 'SingleMuon' : 'SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+TkAlMuonIsolated+MuAlCalIsolatedMu+MuAlOverlaps+MuAlZMuMu+HcalCalIterativePhiSym+HcalCalHO', 'SinglePhoton' : 'HcalCalGammaJet', 'ZeroBias' : 'SiStripCalZeroBias+TkAlMinBias+LumiPixelsMinBias+SiStripCalMinBias+SiStripCalMinBiasAfterAbortGap', 'HcalNZS' : 'HcalCalMinBias' diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index bcae9d17daef9..5fba69d26aff0 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -26,21 +26,21 @@ # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 'run2_mc_pa' : '113X_mcRun2_pA_v3', # GlobalTag for Run2 data reprocessing - 'run2_data' : '113X_dataRun2_v4', + 'run2_data' : '113X_dataRun2_v5', # GlobalTag for Run2 data 2018B relvals only: HEM-15-16 fail - 'run2_data_HEfail' : '113X_dataRun2_HEfail_v4', + 'run2_data_HEfail' : '113X_dataRun2_HEfail_v5', # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu - 'run2_data_relval' : '113X_dataRun2_relval_v4', + 'run2_data_relval' : '113X_dataRun2_relval_v5', # GlobalTag for Run2 HI data - 'run2_data_promptlike_hi' : '113X_dataRun2_PromptLike_HI_v4', + 'run2_data_promptlike_hi' : '113X_dataRun2_PromptLike_HI_v5', # GlobalTag for Run3 HLT: it points to the online GT - 'run3_hlt' : '112X_dataRun3_HLT_v2', + 'run3_hlt' : '112X_dataRun3_HLT_v3', # GlobalTag with fixed snapshot time for Run2 HLT RelVals: customizations to run with fixed L1 Menu - 'run2_hlt_relval' : '112X_dataRun2_HLT_relval_v5', + 'run2_hlt_relval' : '112X_dataRun2_HLT_relval_v6', # GlobalTag for Run3 data relvals (express GT) - 'run3_data_express' : '112X_dataRun3_Express_v4', + 'run3_data_express' : '112X_dataRun3_Express_v5', # GlobalTag for Run3 data relvals - 'run3_data_prompt' : '112X_dataRun3_Prompt_v4', + 'run3_data_prompt' : '112X_dataRun3_Prompt_v5', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) 'phase1_2017_design' : '113X_mc2017_design_v4', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector @@ -64,17 +64,17 @@ # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in PEAK mode 'phase1_2018_cosmics_peak' : '113X_upgrade2018cosmics_realistic_peak_v4', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2021 - 'phase1_2021_design' : '113X_mcRun3_2021_design_v6', # GT containing design conditions for Phase1 2021 + 'phase1_2021_design' : '113X_mcRun3_2021_design_v7', # GT containing design conditions for Phase1 2021 # GlobalTag for MC production with realistic conditions for Phase1 2021 - 'phase1_2021_realistic' : '113X_mcRun3_2021_realistic_v8', # GT containing realistic conditions for Phase1 2021 + 'phase1_2021_realistic' : '113X_mcRun3_2021_realistic_v9', # GT containing realistic conditions for Phase1 2021 # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2021, Strip tracker in DECO mode - 'phase1_2021_cosmics' : '113X_mcRun3_2021cosmics_realistic_deco_v7', + 'phase1_2021_cosmics' : '113X_mcRun3_2021cosmics_realistic_deco_v8', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '113X_mcRun3_2021_realistic_HI_v6', + 'phase1_2021_realistic_hi' : '113X_mcRun3_2021_realistic_HI_v7', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '113X_mcRun3_2023_realistic_v6', # GT containing realistic conditions for Phase1 2023 + 'phase1_2023_realistic' : '113X_mcRun3_2023_realistic_v7', # GT containing realistic conditions for Phase1 2023 # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '113X_mcRun3_2024_realistic_v6', # GT containing realistic conditions for Phase1 2024 + 'phase1_2024_realistic' : '113X_mcRun3_2024_realistic_v7', # GT containing realistic conditions for Phase1 2024 # GlobalTag for MC production with realistic conditions for Phase2 'phase2_realistic' : '113X_mcRun4_realistic_v6' } diff --git a/Configuration/AlCa/python/autoPCL.py b/Configuration/AlCa/python/autoPCL.py index d5fdbdfe42f9f..e2825741730a0 100644 --- a/Configuration/AlCa/python/autoPCL.py +++ b/Configuration/AlCa/python/autoPCL.py @@ -7,5 +7,6 @@ 'PromptCalibProdEcalPedestals': 'EcalPedestals', 'PromptCalibProdSiStripGainsAAG' : 'SiStripGainsAAG', 'PromptCalibProdLumiPCC': 'LumiPCC', - 'PromptCalibProdSiPixel' : 'SiPixelQuality' + 'PromptCalibProdSiPixel' : 'SiPixelQuality', + 'PromptCalibProdPPS' : 'PPSTimingCalibration' } diff --git a/Configuration/Eras/python/Era_Run2_2016_cff.py b/Configuration/Eras/python/Era_Run2_2016_cff.py index 4c340f053eff4..b0100810f4af5 100644 --- a/Configuration/Eras/python/Era_Run2_2016_cff.py +++ b/Configuration/Eras/python/Era_Run2_2016_cff.py @@ -3,6 +3,7 @@ from Configuration.Eras.Modifier_run2_common_cff import run2_common from Configuration.Eras.Modifier_run2_25ns_specific_cff import run2_25ns_specific from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger +from Configuration.Eras.Modifier_ctpps_cff import ctpps from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import run2_HLTconditions_2016 from Configuration.Eras.Modifier_run2_muon_2016_cff import run2_muon_2016 @@ -14,5 +15,5 @@ from Configuration.Eras.Modifier_run2_ECAL_2016_cff import run2_ECAL_2016 Run2_2016 = cms.ModifierChain(run2_common, run2_25ns_specific, - stage2L1Trigger, ctpps_2016, run2_HLTconditions_2016, run2_ECAL_2016, run2_muon_2016, run2_egamma_2016, run2_L1prefiring, pixel_2016, run2_jme_2016, strips_vfp30_2016) + stage2L1Trigger, ctpps, ctpps_2016, run2_HLTconditions_2016, run2_ECAL_2016, run2_muon_2016, run2_egamma_2016, run2_L1prefiring, pixel_2016, run2_jme_2016, strips_vfp30_2016) diff --git a/Configuration/Eras/python/Era_Run2_2017_cff.py b/Configuration/Eras/python/Era_Run2_2017_cff.py index aad81da12e95b..0fbe87a05e9d8 100644 --- a/Configuration/Eras/python/Era_Run2_2017_cff.py +++ b/Configuration/Eras/python/Era_Run2_2017_cff.py @@ -17,13 +17,14 @@ from Configuration.Eras.Modifier_run2_muon_2016_cff import run2_muon_2016 from Configuration.Eras.Modifier_run2_egamma_2017_cff import run2_egamma_2017 from Configuration.Eras.Modifier_run2_egamma_2016_cff import run2_egamma_2016 +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 from Configuration.Eras.Modifier_pixel_2016_cff import pixel_2016 from Configuration.Eras.Modifier_run2_jme_2017_cff import run2_jme_2017 from Configuration.Eras.Modifier_run2_jme_2016_cff import run2_jme_2016 from Configuration.Eras.Modifier_strips_vfp30_2016_cff import strips_vfp30_2016 -Run2_2017 = cms.ModifierChain(Run2_2016.copyAndExclude([run2_muon_2016, run2_HLTconditions_2016, run2_ECAL_2016, run2_egamma_2016,pixel_2016,run2_jme_2016, strips_vfp30_2016]), +Run2_2017 = cms.ModifierChain(Run2_2016.copyAndExclude([run2_muon_2016, run2_HLTconditions_2016, run2_ECAL_2016, run2_egamma_2016,pixel_2016,run2_jme_2016, strips_vfp30_2016, ctpps_2016]), phase1Pixel, run2_ECAL_2017, run2_HF_2017, run2_HCAL_2017, run2_HE_2017, run2_HEPlan1_2017, trackingPhase1, run2_GEM_2017, stage2L1Trigger_2017, run2_HLTconditions_2017, run2_muon_2017,run2_egamma_2017, ctpps_2017, run2_jme_2017) diff --git a/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_cff.py b/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_cff.py index 8a52dee220994..8ddbed4872a96 100644 --- a/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_cff.py +++ b/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_cff.py @@ -3,6 +3,5 @@ from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 -from Configuration.Eras.Modifier_pf_badHcalMitigation_cff import pf_badHcalMitigation -Run2_2018_pp_on_AA = cms.ModifierChain(Run2_2018, pp_on_AA, pp_on_AA_2018, pf_badHcalMitigation) +Run2_2018_pp_on_AA = cms.ModifierChain(Run2_2018, pp_on_AA, pp_on_AA_2018) diff --git a/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_noHCALmitigation_cff.py b/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_noHCALmitigation_cff.py index b6e6c62f8526d..3ce8b9d3e9493 100644 --- a/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_noHCALmitigation_cff.py +++ b/Configuration/Eras/python/Era_Run2_2018_pp_on_AA_noHCALmitigation_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run2_2018_pp_on_AA_cff import Run2_2018_pp_on_AA -from Configuration.Eras.Modifier_pf_badHcalMitigation_cff import pf_badHcalMitigation +from Configuration.Eras.Modifier_pf_badHcalMitigationOff_cff import pf_badHcalMitigationOff + +Run2_2018_pp_on_AA_noHCALmitigation = cms.ModifierChain(Run2_2018_pp_on_AA,pf_badHcalMitigationOff) -Run2_2018_pp_on_AA_noHCALmitigation = cms.ModifierChain(Run2_2018_pp_on_AA.copyAndExclude([pf_badHcalMitigation])) diff --git a/Configuration/Eras/python/Modifier_pf_badHcalMitigation_cff.py b/Configuration/Eras/python/Modifier_ctpps_cff.py similarity index 51% rename from Configuration/Eras/python/Modifier_pf_badHcalMitigation_cff.py rename to Configuration/Eras/python/Modifier_ctpps_cff.py index 3a29156e0ba85..9f39c97ec0fa5 100644 --- a/Configuration/Eras/python/Modifier_pf_badHcalMitigation_cff.py +++ b/Configuration/Eras/python/Modifier_ctpps_cff.py @@ -1,3 +1,4 @@ import FWCore.ParameterSet.Config as cms -pf_badHcalMitigation = cms.Modifier() +ctpps = cms.Modifier() + diff --git a/Configuration/Eras/python/Modifier_pf_badHcalMitigationOff_cff.py b/Configuration/Eras/python/Modifier_pf_badHcalMitigationOff_cff.py new file mode 100644 index 0000000000000..59df5549570ce --- /dev/null +++ b/Configuration/Eras/python/Modifier_pf_badHcalMitigationOff_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +pf_badHcalMitigationOff = cms.Modifier() diff --git a/Configuration/EventContent/python/AlCaRecoOutput_RelVal_cff.py b/Configuration/EventContent/python/AlCaRecoOutput_RelVal_cff.py index 297a7e193a5ff..cae150ddc772f 100644 --- a/Configuration/EventContent/python/AlCaRecoOutput_RelVal_cff.py +++ b/Configuration/EventContent/python/AlCaRecoOutput_RelVal_cff.py @@ -26,6 +26,8 @@ 'keep *_ALCARECOMuAlOverlaps_*_*', 'keep *_ALCARECOMuAlCalIsolatedMu_*_*', 'keep *_ALCARECOSiPixelCalSingleMuon_*_*', + 'keep *_ALCARECOSiPixelCalSingleMuonLoose_*_*', + 'keep *_ALCARECOSiPixelCalSingleMuonTight_*_*', 'keep *_ALCARECOSiPixelCalCosmics_*_*', 'keep *_cosmicMuons_*_*', 'keep *_cosmictrackfinderP5_*_*', diff --git a/Configuration/EventContent/python/AlCaRecoOutput_cff.py b/Configuration/EventContent/python/AlCaRecoOutput_cff.py index f9e64e4508cae..aab0d9c3fab2f 100644 --- a/Configuration/EventContent/python/AlCaRecoOutput_cff.py +++ b/Configuration/EventContent/python/AlCaRecoOutput_cff.py @@ -40,6 +40,8 @@ # AlCaReco for pixel calibration using muons from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuon_Output_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuonLoose_Output_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuonTight_Output_cff import * # AlCaReco for tracker calibration using MinBias events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalMinBias_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalMinBiasAAG_Output_cff import * @@ -47,7 +49,7 @@ from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalZeroBias_Output_cff import * # AlCaReco for SiPixel Bad Component using ZeroBias events from CalibTracker.SiPixelQuality.ALCARECOSiPixelCalZeroBias_Output_cff import * -# AlCaReco for tracker calibration using Cosmics events +# AlCaReco for tracker calibration using Cosmics events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalCosmics_Output_cff import * @@ -134,6 +136,12 @@ from CalibMuon.DTCalibration.ALCARECODtCalibHI_Output_cff import * from CalibMuon.DTCalibration.ALCARECODtCalibCosmics_Output_cff import * +############################################################### +# PPS calibration +############################################################### +from CalibPPS.TimingCalibration.ALCARECOPPSCalTrackBasedSel_Output_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSTimingCalib_Output_cff import * + ############################################################### # stream for prompt-calibration @ Tier0 ############################################################### diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index e7bd292dbf241..15c2f93f807fb 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -212,7 +212,7 @@ def SwapKeepAndDrop(l): RECOEventContent.outputCommands.extend(CommonEventContent.outputCommands) RECOEventContent.outputCommands.extend(EITopPAGEventContent.outputCommands) -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_cff import ctpps from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon @@ -223,7 +223,7 @@ def SwapKeepAndDrop(l): from RecoLocalFastTime.Configuration.RecoLocalFastTime_EventContent_cff import * from RecoMTD.Configuration.RecoMTD_EventContent_cff import * -ctpps_2016.toModify(RECOEventContent, +ctpps.toModify(RECOEventContent, outputCommands = RECOEventContent.outputCommands + RecoCTPPSRECO.outputCommands) phase2_hgcal.toModify(RECOEventContent, outputCommands = RECOEventContent.outputCommands + TICL_RECO.outputCommands) @@ -276,7 +276,7 @@ def SwapKeepAndDrop(l): AODEventContent.outputCommands.extend(TcdsEventContent.outputCommands) AODEventContent.outputCommands.extend(CommonEventContent.outputCommands) -ctpps_2016.toModify(AODEventContent, +ctpps.toModify(AODEventContent, outputCommands = AODEventContent.outputCommands + RecoCTPPSAOD.outputCommands) phase2_hgcal.toModify(AODEventContent, outputCommands = AODEventContent.outputCommands + TICL_AOD.outputCommands) @@ -486,7 +486,7 @@ def SwapKeepAndDrop(l): FEVTEventContent.outputCommands.extend(CommonEventContent.outputCommands) FEVTEventContent.outputCommands.extend(EITopPAGEventContent.outputCommands) -ctpps_2016.toModify(FEVTEventContent, +ctpps.toModify(FEVTEventContent, outputCommands = FEVTEventContent.outputCommands + RecoCTPPSFEVT.outputCommands) phase2_hgcal.toModify(FEVTEventContent, outputCommands = FEVTEventContent.outputCommands + TICL_FEVT.outputCommands) diff --git a/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py new file mode 100644 index 0000000000000..c303f50a5bb72 --- /dev/null +++ b/Configuration/Generator/python/SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi.py @@ -0,0 +1,271 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +SLHA_TABLE = """ +Block MODSEL # Model selection + 1 0 # Generic MSSM +Block MINPAR # Input parameters + 3 1.00000000E+00 # tanb at m_Z +# +Block SMINPUTS # SM parameters + 1 1.27931277E+02 # alpha_em^-1(MZ)^MSbar + 2 1.16639000E-05 # G_mu [GeV^-2] + 3 1.17200000E-01 # alpha_s(MZ)^MSbar + 4 9.11876000E+01 # m_Z(pole) + 5 4.20000000E+00 # m_b(m_b), MSbar + 6 1.74300000E+02 # m_t(pole) + 7 1.77700000E+00 # m_tau(pole) +Block MASS # Mass spectrum +# PDG code mass particle + 24 8.04009772E+01 # W+ + 25 10.0E+4 # h0 + 35 10.0E+4 # H0 + 36 10.0E+4 # A0 + 37 10.0E+4 # H+ + 1000001 10.0E+4 # ~d_L + 2000001 10.0E+4 # ~d_R + 1000002 10.0E+4 # ~u_L + 2000002 10.0E+4 # ~u_R + 1000003 10.0E+4 # ~s_L + 2000003 10.0E+4 # ~s_R + 1000004 10.0E+4 # ~c_L + 2000004 10.0E+4 # ~c_R + 1000005 10.0E+4 # ~b_1 + 2000005 10.0E+4 # ~b_2 + 1000006 10.0E+4 # ~t_1 + 2000006 10.0E+4 # ~t_2 + 1000011 10.0E+4 # ~e_L- + 2000011 10.0E+4 # ~e_R- + 1000012 10.0E+4 # ~nu_eL + 1000013 10.0E+4 # ~mu_L- + 2000013 10.0E+4 # ~mu_R- + 1000014 10.0E+4 # ~nu_muL + 1000015 10.0E+4 # ~tau_1- + 2000015 10.0E+4 # ~tau_2- + 1000016 10.0E+4 # ~nu_tauL + 1000021 1.50E+3 # ~g + 1000022 1.00E+2 # ~chi_10 + 1000023 10.0E+4 # ~chi_20 + 1000025 10.0E+4 # ~chi_30 + 1000035 10.0E+4 # ~chi_40 + 1000024 10.0E+4 # ~chi_1+ + 1000037 10.0E+4 # ~chi_2+ +# +BLOCK NMIX # Neutralino Mixing Matrix + 1 1 9.79183656E-01 # N_11 + 1 2 -8.70017948E-02 # N_12 + 1 3 1.75813037E-01 # N_13 + 1 4 -5.21520034E-02 # N_14 + 2 1 1.39174513E-01 # N_21 + 2 2 9.44472080E-01 # N_22 + 2 3 -2.71658234E-01 # N_23 + 2 4 1.21674770E-01 # N_24 + 3 1 -7.50233573E-02 # N_31 + 3 2 1.16844446E-01 # N_32 + 3 3 6.87186106E-01 # N_33 + 3 4 7.13087741E-01 # N_34 + 4 1 -1.27284400E-01 # N_41 + 4 2 2.94534470E-01 # N_42 + 4 3 6.50435881E-01 # N_43 + 4 4 -6.88462993E-01 # N_44 +# +BLOCK UMIX # Chargino Mixing Matrix U + 1 1 9.15480281E-01 # U_11 + 1 2 -4.02362840E-01 # U_12 + 2 1 4.02362840E-01 # U_21 + 2 2 9.15480281E-01 # U_22 +# +BLOCK VMIX # Chargino Mixing Matrix V + 1 1 9.82636204E-01 # V_11 + 1 2 -1.85542692E-01 # V_12 + 2 1 1.85542692E-01 # V_21 + 2 2 9.82636204E-01 # V_22 +# +BLOCK STOPMIX # Stop Mixing Matrix + 1 1 1.0 # cos(theta_t) + 1 2 0.0 # sin(theta_t) + 2 1 0.0 # -sin(theta_t) + 2 2 1.0 # cos(theta_t) +# +BLOCK SBOTMIX # Sbottom Mixing Matrix + 1 1 9.66726392E-01 # cos(theta_b) + 1 2 2.55812594E-01 # sin(theta_b) + 2 1 -2.55812594E-01 # -sin(theta_b) + 2 2 9.66726392E-01 # cos(theta_b) +# +BLOCK STAUMIX # Stau Mixing Matrix + 1 1 4.51419848E-01 # cos(theta_tau) + 1 2 8.92311672E-01 # sin(theta_tau) + 2 1 -8.92311672E-01 # -sin(theta_tau) + 2 2 4.51419848E-01 # cos(theta_tau) +# +BLOCK ALPHA # Higgs mixing + -1.13676047E-01 # Mixing angle in the neutral Higgs boson sector +# +BLOCK HMIX Q= 2.90528802E+02 # DRbar Higgs Parameters + 1 3.05599351E+02 # mu(Q)MSSM +# +BLOCK AU Q= 2.90528802E+02 # The trilinear couplings + 1 1 0.00000000E+00 # A_u(Q) DRbar + 2 2 0.00000000E+00 # A_c(Q) DRbar + 3 3 -4.46245994E+02 # A_t(Q) DRbar +# +BLOCK AD Q= 2.90528802E+02 # The trilinear couplings + 1 1 0.00000000E+00 # A_d(Q) DRbar + 2 2 0.00000000E+00 # A_s(Q) DRbar + 3 3 -8.28806503E+02 # A_b(Q) DRbar +# +BLOCK AE Q= 2.90528802E+02 # The trilinear couplings + 1 1 0.00000000E+00 # A_e(Q) DRbar + 2 2 0.00000000E+00 # A_mu(Q) DRbar + 3 3 -4.92306701E+02 # A_tau(Q) DRbar +# +BLOCK MSOFT Q= 2.90528802E+02 # The soft SUSY breaking masses at the scale Q + 1 6.39136864E+01 # M_1(Q) + 2 1.22006983E+02 # M_2(Q) + 3 3.90619532E+02 # M_3(Q) + 21 4.42860395E+04 # mH1^2(Q) + 22 -9.76585434E+04 # mH2^2(Q) + 31 2.26648170E+02 # meL(Q) + 32 2.26648170E+02 # mmuL(Q) + 33 2.24355944E+02 # mtauL(Q) + 34 2.08394096E+02 # meR(Q) + 35 2.08394096E+02 # mmuR(Q) + 36 2.03337218E+02 # mtauR(Q) + 41 4.08594291E+02 # mqL1(Q) + 42 4.08594291E+02 # mqL2(Q) + 43 3.46134575E+02 # mqL3(Q) + 44 3.98943379E+02 # muR(Q) + 45 3.98943379E+02 # mcR(Q) + 46 2.58021672E+02 # mtR(Q) + 47 3.95211849E+02 # mdR(Q) + 48 3.95211849E+02 # msR(Q) + 49 3.90320031E+02 # mbR(Q) +# +# +# +# ================= +# |The decay table| +# ================= +# +# - The QCD corrections to the decays gluino -> squark + quark +# squark -> gaugino + quark_prime +# squark -> squark_prime + Higgs +# squark -> gluino + quark +# are included. +# +# - The multi-body decays for the inos, stops and sbottoms are included. +# +# - The loop induced decays for the gluino, neutralinos and stops +# are included. +# +# - The SUSY decays of the top quark are included. +# +# +# +# PDG Width +DECAY 1000022 0.00000000E+00 # neutralino1 decays +DECAY 1000021 1.00000000E+00 # gluino decays +# BR NDA ID1 ID2 + 0.000000E+00 3 1000022 1 -1 + 0.000000E+00 3 1000022 2 -2 + 0.000000E+00 3 1000022 3 -3 + 0.000000E+00 3 1000022 4 -4 + 0.000000E+00 3 1000022 5 -5 + 1.000000E+00 3 1000022 6 -6 +# +# PDG Width +DECAY 1000006 0.00000000E+00 # stop1 decays +DECAY 2000006 0.00000000E+00 # stop2 decays +DECAY 1000005 0.00000000E+00 # sbottom1 decays +DECAY 2000005 0.00000000E+00 # sbottom2 decays +# +# PDG Width +DECAY 1000002 1.00000000E+00 # sup_L decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 2 # BR(~u_L -> ~chi_10 u) +# +# PDG Width +DECAY 2000002 1.00000000E+00 # sup_R decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 2 # BR(~u_R -> ~chi_10 u) +# +# PDG Width +DECAY 1000001 1.00000000E+00 # sdown_L decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 1 # BR(~d_L -> ~chi_10 d) +# +# PDG Width +DECAY 2000001 1.00000000E+00 # sdown_R decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 1 # BR(~d_R -> ~chi_10 d) +# +# PDG Width +DECAY 1000004 1.00000000E+00 # scharm_L decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 4 # BR(~c_L -> ~chi_10 c) +# +# PDG Width +DECAY 2000004 1.00000000E+00 # scharm_R decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 4 # BR(~c_R -> ~chi_10 c) +# +# PDG Width +DECAY 1000003 1.00000000E+00 # sstrange_L decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 3 # BR(~s_L -> ~chi_10 s) +# +# PDG Width +DECAY 2000003 1.00000000E+00 # sstrange_R decays +# BR NDA ID1 ID2 + 1.00000000E+00 2 1000022 3 # BR(~s_R -> ~chi_10 s) +# +# PDG Width +DECAY 1000011 0.00000000E+00 # selectron_L decays +DECAY 2000011 0.00000000E+00 # selectron_R decays +DECAY 1000013 0.00000000E+00 # smuon_L decays +DECAY 2000013 0.00000000E+00 # smuon_R decays +DECAY 1000015 0.00000000E+00 # stau_1 decays +DECAY 2000015 0.00000000E+00 # stau_2 decays +# +# PDG Width +DECAY 1000012 0.00000000E+00 # snu_elL decays +DECAY 1000014 0.00000000E+00 # snu_muL decays +DECAY 1000016 0.00000000E+00 # snu_tauL decays +# PDG Width +DECAY 1000024 2.02592183E-05 # chargino1+ decays +# BR NDA ID1 ID2 ID3 + 0.33333333E+00 3 1000022 -11 12 # BR(~chi_1+ -> ~chi_10 e+ nu_e) + 0.33333333E+00 3 1000022 -13 14 # BR(~chi_1+ -> ~chi_10 mu+ nu_mu) + 0.33333333E+00 3 1000022 -15 16 # BR(~chi_1+ -> ~chi_10 tau+ nu_tau) +# PDG Width +DECAY 1000037 0.00000000E+00 # chargino2+ decays +DECAY 1000023 0.00000000E+00 # neutralino2 decays +DECAY 1000025 0.00000000E+00 # neutralino3 decays +DECAY 1000035 0.00000000E+00 # neutralino4 decays +""" + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaPylistVerbosity = cms.untracked.int32(0), + filterEfficiency = cms.untracked.double(1.0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + comEnergy = cms.double(14000), + SLHATableForPythia8 = cms.string(SLHA_TABLE), + maxEventsToPrint = cms.untracked.int32(0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'SUSY:all = off', + 'SUSY:gg2gluinogluino = on', + 'SUSY:qqbar2gluinogluino = on', + ), + parameterSets = cms.vstring( + 'pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters' + ) + ) +) diff --git a/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py new file mode 100644 index 0000000000000..84cafcd9d62c4 --- /dev/null +++ b/Configuration/Generator/python/VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi.py @@ -0,0 +1,29 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + comEnergy = cms.double(14000.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(1), + filterEfficiency = cms.untracked.double(1.0), + crossSection = cms.untracked.double(0.004783), # 4.233 pb * 0.00113 (qqH * BR(4v)) + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'HiggsSM:ff2Hff(t:ZZ) = on', + 'HiggsSM:ff2Hff(t:WW) = on', + '25:m0 = 125', + '25:onMode = off', + '25:onIfMatch = 23 23', + '23:onMode = off', + '23:onIfAny = 12 14 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) diff --git a/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py new file mode 100644 index 0000000000000..30501a7412bb2 --- /dev/null +++ b/Configuration/Generator/python/ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi.py @@ -0,0 +1,51 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + comEnergy = cms.double(14000.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(1), + filterEfficiency = cms.untracked.double(1.0), + crossSection = cms.untracked.double(0.00002497), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'NewGaugeBoson:ffbar2gmZZprime = on', + 'Zprime:gmZmode = 3', + 'Zprime:vd = 0.0', + 'Zprime:ad = 0.506809', + 'Zprime:vu = 0.0', + 'Zprime:au = 0.506809', + 'Zprime:ve = 0.0', + 'Zprime:ae = 0.506809', + 'Zprime:vnue = -0.253405', + 'Zprime:anue = 0.253405', + 'Zprime:vs = 0.0', + 'Zprime:as = 0.506809', + 'Zprime:vc = 0.0', + 'Zprime:ac = 0.506809', + 'Zprime:vmu = 0.0', + 'Zprime:amu = 0.506809', + 'Zprime:vnumu = -0.253405', + 'Zprime:anumu = 0.253405', + 'Zprime:vb = 0.0', + 'Zprime:ab = 0.506809', + 'Zprime:vt = 0.0', + 'Zprime:at = 0.506809', + 'Zprime:vtau = 0.0', + 'Zprime:atau = 0.506809', + 'Zprime:vnutau = -0.253405', + 'Zprime:anutau = 0.253405', + '32:m0 =6000', + '32:onMode = off', + '32:onIfAny = 11', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) diff --git a/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py new file mode 100644 index 0000000000000..d160723c7b466 --- /dev/null +++ b/Configuration/Generator/python/ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi.py @@ -0,0 +1,51 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + comEnergy = cms.double(14000.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(1), + filterEfficiency = cms.untracked.double(1.0), + crossSection = cms.untracked.double(0.00002497), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'NewGaugeBoson:ffbar2gmZZprime = on', + 'Zprime:gmZmode = 3', + 'Zprime:vd = 0.0', + 'Zprime:ad = 0.506809', + 'Zprime:vu = 0.0', + 'Zprime:au = 0.506809', + 'Zprime:ve = 0.0', + 'Zprime:ae = 0.506809', + 'Zprime:vnue = -0.253405', + 'Zprime:anue = 0.253405', + 'Zprime:vs = 0.0', + 'Zprime:as = 0.506809', + 'Zprime:vc = 0.0', + 'Zprime:ac = 0.506809', + 'Zprime:vmu = 0.0', + 'Zprime:amu = 0.506809', + 'Zprime:vnumu = -0.253405', + 'Zprime:anumu = 0.253405', + 'Zprime:vb = 0.0', + 'Zprime:ab = 0.506809', + 'Zprime:vt = 0.0', + 'Zprime:at = 0.506809', + 'Zprime:vtau = 0.0', + 'Zprime:atau = 0.506809', + 'Zprime:vnutau = -0.253405', + 'Zprime:anutau = 0.253405', + '32:m0 =6000', + '32:onMode = off', + '32:onIfAny = 13', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) diff --git a/Configuration/Geometry/README.md b/Configuration/Geometry/README.md index eb143fa127cb0..bbd781d381960 100644 --- a/Configuration/Geometry/README.md +++ b/Configuration/Geometry/README.md @@ -59,6 +59,8 @@ Calorimeters: * C12: HGCal (as in C11) + HFNose with corrected wafer size + Phase2 HCAL and EB * C13: HGCal (reading the constants of the flat file and made provision to be used downstream) + Phase2 HCAL and EB * C14: HGCal (reading the constants of the flat file and use it to create geometry) + Phase2 HCAL and EB +* C15: HGCal (as in C14) + HFNose with corrected wafer size + Phase2 HCAL and EB +* C16: HGCal (create HGCal geometry with real full and partial silicon modules using the constants of the flat file) + Phase2 HCAL and EB Muon system: * M4: Phase2 muon system for TDR w/ GE2/1, ME0, RE3/1, RE4/1 (incl. granularity in ME0, staggered GE2/1), 96 iRPC strips, no overlaps, MB4Shields @@ -83,6 +85,7 @@ The script also handles the common and forward elements of the geometry: * F4: same as F2 but with modifications needed to forward shield * F5: same as F4 but changes due to HFNose * F6: same as F4 with modifications needed for BRM and forward shield +* F7: same as F6 with modifications needed for HFNose Several detector combinations have been generated: * D49 = T15+C9+M4+I10+O4+F2 (HLT TDR baseline) @@ -95,3 +98,6 @@ Several detector combinations have been generated: * D79 = T23+C14+M9+I13+O7+F6 * D80 = T25+C14+M9+I13+O7+F6 * D81 = T26+C14+M9+I13+O7+F6 +* D82 = T21+C15+M9+I13+O7+F7 +* D83 = T24+C16+M9+I13+O7+F6 +* D84 = T24+C13+M7+I11+O6+F6 (For HGCAL study on evolution of HGCal replacing D70) diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2026D82Reco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2026D82Reco_cff.py new file mode 100644 index 0000000000000..a75e1525a9f8b --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2026D82Reco_cff.py @@ -0,0 +1,62 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hepExtended2026D82_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = cms.bool(False) + +# calo +from Geometry.CaloEventSetup.HGCalV9Topology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.HFNoseTopology_cfi import * +from Geometry.ForwardGeometry.HFNoseGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive", + "HGCalHFNoseSensitive", + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = cms.bool(False) + diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2026D82_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2026D82_cff.py new file mode 100644 index 0000000000000..29501f2713501 --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2026D82_cff.py @@ -0,0 +1,18 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hep_cff import * +DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D82.xml") + +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.ForwardCommonData.hfnoseParametersInitialization_cfi import * +from Geometry.ForwardCommonData.hfnoseNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2026D83Reco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2026D83Reco_cff.py new file mode 100644 index 0000000000000..20938526fdef8 --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2026D83Reco_cff.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hepExtended2026D83_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = cms.bool(False) + +# calo +from Geometry.CaloEventSetup.HGCalV9Topology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive" + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = cms.bool(False) + diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2026D83_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2026D83_cff.py new file mode 100644 index 0000000000000..1d900d3d1416f --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2026D83_cff.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hep_cff import * +DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D83.xml") + +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2026D84Reco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2026D84Reco_cff.py new file mode 100644 index 0000000000000..39f8ce3c75ffc --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2026D84Reco_cff.py @@ -0,0 +1,60 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hepExtended2026D84_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = cms.bool(False) + +# calo +from Geometry.CaloEventSetup.HGCalV9Topology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive" + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * +from Geometry.GEMGeometryBuilder.me0Geometry_cfi import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = cms.bool(False) + diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2026D84_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2026D84_cff.py new file mode 100644 index 0000000000000..51f486a4f033f --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2026D84_cff.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hep_cff import * +DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D84.xml") + +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/GeometryExtended2026D82Reco_cff.py b/Configuration/Geometry/python/GeometryExtended2026D82Reco_cff.py new file mode 100644 index 0000000000000..3d2e43b66af90 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2026D82Reco_cff.py @@ -0,0 +1,62 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryExtended2026D82_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = cms.bool(False) + +# calo +from Geometry.CaloEventSetup.HGCalV9Topology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.HFNoseTopology_cfi import * +from Geometry.ForwardGeometry.HFNoseGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive", + "HGCalHFNoseSensitive", + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = cms.bool(False) + diff --git a/Configuration/Geometry/python/GeometryExtended2026D82_cff.py b/Configuration/Geometry/python/GeometryExtended2026D82_cff.py new file mode 100644 index 0000000000000..e6d683b8e84b3 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2026D82_cff.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Geometry.CMSCommonData.cmsExtendedGeometry2026D82XML_cfi import * +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.ForwardCommonData.hfnoseParametersInitialization_cfi import * +from Geometry.ForwardCommonData.hfnoseNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/GeometryExtended2026D83Reco_cff.py b/Configuration/Geometry/python/GeometryExtended2026D83Reco_cff.py new file mode 100644 index 0000000000000..077457796a218 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2026D83Reco_cff.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryExtended2026D83_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = cms.bool(False) + +# calo +from Geometry.CaloEventSetup.HGCalV9Topology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive" + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = cms.bool(False) + diff --git a/Configuration/Geometry/python/GeometryExtended2026D83_cff.py b/Configuration/Geometry/python/GeometryExtended2026D83_cff.py new file mode 100644 index 0000000000000..09f7c3f18aee0 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2026D83_cff.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Geometry.CMSCommonData.cmsExtendedGeometry2026D83XML_cfi import * +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/GeometryExtended2026D84Reco_cff.py b/Configuration/Geometry/python/GeometryExtended2026D84Reco_cff.py new file mode 100644 index 0000000000000..cd929ff734969 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2026D84Reco_cff.py @@ -0,0 +1,60 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryExtended2026D84_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = cms.bool(False) + +# calo +from Geometry.CaloEventSetup.HGCalV9Topology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive" + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cfi import * +from Geometry.GEMGeometryBuilder.me0Geometry_cfi import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = cms.bool(False) + diff --git a/Configuration/Geometry/python/GeometryExtended2026D84_cff.py b/Configuration/Geometry/python/GeometryExtended2026D84_cff.py new file mode 100644 index 0000000000000..3789ee04824d4 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2026D84_cff.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Geometry.CMSCommonData.cmsExtendedGeometry2026D84XML_cfi import * +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 67176d5866955..0a8bef7a8026a 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -1784,7 +1784,7 @@ "default" : 1, "C1" : { 1 : [ - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -1994,8 +1994,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station.xml', @@ -2097,8 +2097,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station.xml', @@ -2200,8 +2200,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Configuration/Geometry/python/dict2026Geometry.py b/Configuration/Geometry/python/dict2026Geometry.py index fd385a41ceed6..d3a363a8d5f49 100644 --- a/Configuration/Geometry/python/dict2026Geometry.py +++ b/Configuration/Geometry/python/dict2026Geometry.py @@ -85,60 +85,6 @@ ], "era" : "phase2_common, phase2_trigger", }, - "O5" : { - 1 : [ - 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', - 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', - 'Geometry/CMSCommonData/data/cms/2026/v4/cms.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v3/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2026/v4/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2026/v2/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', - 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', - ], - 5 : [ - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ], - "era" : "phase2_common, phase2_trigger", - }, - "O6" : { - 1 : [ - 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', - 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', - 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v4/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2026/v5/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2026/v3/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', - 'Geometry/CMSCommonData/data/muonMB.xml', - 'Geometry/CMSCommonData/data/muonMagnet.xml', - 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', - 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', - ], - 5 : [ - 'Geometry/CMSCommonData/data/FieldParameters.xml', - ], - "era" : "phase2_common, phase2_trigger", - }, "O7" : { 1 : [ 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', @@ -363,7 +309,6 @@ 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelsens.xml', 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/trackerRecoMaterial.xml', - 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', @@ -398,7 +343,6 @@ 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelsens.xml', 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/trackerRecoMaterial.xml', - 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', @@ -801,6 +745,166 @@ ], "era" : "phase2_ecal, phase2_hcal, phase2_hgcal, hcalHardcodeConditions, phase2_hgcalV10, phase2_hgcalV11, phase2_hgcalV12, phase2_hfnose", }, + "C15" : { + 1 : [ + 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo/v1/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v14/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v14/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v14/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v14/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v14/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v13/hgcalConsData.xml', + 'Geometry/ForwardCommonData/data/hfnose/v4/hfnose.xml', + 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml', + 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnoseWafer.xml', + 'Geometry/ForwardCommonData/data/hfnoseLayer/v2/hfnoseLayer.xml', + 'Geometry/ForwardCommonData/data/hfnoseCons/v1m/hfnoseCons.xml', + ], + 3 : [ + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2026/v5c/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv9.xml', + 'Geometry/ForwardSimData/data/hfnosesens.xml', + ], + 4 : [ + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv9.xml', + 'Geometry/ForwardSimData/data/hfnoseProdCuts.xml', + ], + "sim" : [ + 'from Geometry.EcalCommonData.ecalSimulationParameters_cff import *', + 'from Geometry.HcalCommonData.hcalDDDSimConstants_cff import *', + 'from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import *', + 'from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import *', + 'from Geometry.ForwardCommonData.hfnoseParametersInitialization_cfi import *', + 'from Geometry.ForwardCommonData.hfnoseNumberingInitialization_cfi import *', + ], + "reco" : [ + 'from Geometry.CaloEventSetup.HGCalV9Topology_cfi import *', + 'from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import *', + 'from Geometry.CaloEventSetup.HFNoseTopology_cfi import *', + 'from Geometry.ForwardGeometry.HFNoseGeometryESProducer_cfi import *', + 'from Geometry.CaloEventSetup.CaloTopology_cfi import *', + 'from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import *', + 'CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder",', + ' SelectedCalos = cms.vstring("HCAL",', + ' "ZDC",', + ' "EcalBarrel",', + ' "TOWER",', + ' "HGCalEESensitive",', + ' "HGCalHESiliconSensitive",', + ' "HGCalHEScintillatorSensitive",', + ' "HGCalHFNoseSensitive",', + ' )', + ')', + 'from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import *', + 'from Geometry.HcalEventSetup.HcalGeometry_cfi import *', + 'from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import *', + 'from Geometry.HcalEventSetup.CaloTowerTopology_cfi import *', + 'from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import *', + 'from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import *', + 'from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import *', + 'from Geometry.EcalMapping.EcalMapping_cfi import *', + 'from Geometry.EcalMapping.EcalMappingRecord_cfi import *', + ], + "era" : "phase2_ecal, phase2_hcal, phase2_hgcal, hcalHardcodeConditions, phase2_hgcalV10, phase2_hgcalV11, phase2_hgcalV12, phase2_hfnose", + }, + "C16" : { + 1 : [ + 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v15/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v15/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v15/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v15/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v15/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v15/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v15/hgcalConsData.xml', + ], + 3 : [ + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2026/v2c/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv15.xml', + ], + 4 : [ + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv15.xml', + ], + "sim" : [ + 'from Geometry.EcalCommonData.ecalSimulationParameters_cff import *', + 'from Geometry.HcalCommonData.hcalDDDSimConstants_cff import *', + 'from Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi import *', + 'from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import *' + ], + "reco" : [ + 'from Geometry.CaloEventSetup.HGCalV9Topology_cfi import *', + 'from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import *', + 'from Geometry.CaloEventSetup.CaloTopology_cfi import *', + 'from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import *', + 'CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder",', + ' SelectedCalos = cms.vstring("HCAL",', + ' "ZDC",', + ' "EcalBarrel",', + ' "TOWER",', + ' "HGCalEESensitive",', + ' "HGCalHESiliconSensitive",', + ' "HGCalHEScintillatorSensitive"', + ' )', + ')', + 'from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import *', + 'from Geometry.HcalEventSetup.HcalGeometry_cfi import *', + 'from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import *', + 'from Geometry.HcalEventSetup.CaloTowerTopology_cfi import *', + 'from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import *', + 'from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import *', + 'from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import *', + 'from Geometry.EcalMapping.EcalMapping_cfi import *', + 'from Geometry.EcalMapping.EcalMappingRecord_cfi import *', + ], + "era" : "phase2_ecal, phase2_hcal, phase2_hgcal, hcalHardcodeConditions, phase2_hgcalV10, phase2_hgcalV11, phase2_hgcalV12, phase2_hfnose", + }, } @@ -1103,6 +1207,31 @@ 'from Geometry.ForwardGeometry.ForwardGeometry_cfi import *', ] }, + "F7" : { + 1 : [ + 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + ], + 3 : [ + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + ], + 4 : [ + 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + ], + "reco" :[ + 'from Geometry.ForwardGeometry.ForwardGeometry_cfi import *', + ] + }, } timingDict = { @@ -1208,6 +1337,9 @@ ("O7","T23","C14","M9","F6","I13") : "D79", ("O7","T25","C14","M9","F6","I13") : "D80", ("O7","T26","C14","M9","F6","I13") : "D81", + ("O7","T21","C15","M9","F7","I13") : "D82", + ("O7","T24","C16","M9","F6","I13") : "D83", + ("O6","T24","C13","M7","F6","I11") : "D84", } deprecatedDets = set([ "D1", "D2", "D3", "D5", "D6" , "D7", "D4", "D8" , "D9", "D12", "D13", "D15", "D10", "D11", "D14", "D16", "D17", "D18", "D19", "D20", "D21", "D22", "D23", "D24", "D25", "D26", "D27", "D28", "D29", "D30", "D31", "D32", "D33", "D34", "D36", "D37", "D38", "D39", "D40", "D42", "D35", "D41", "D43", "D44", "D45", "D46", "D48", "D47", "D50", "D51", "D52", "D53", "D54", "D55", "D56", "D57", "D58", "D59", "D61", "D62", "D63", "D64", "D65", "D66", "D67", "D69", "D71", "D72", "D73", "D74", "D75"]) diff --git a/Configuration/HLT/python/addOnTestsHLT.py b/Configuration/HLT/python/addOnTestsHLT.py index 46e02a4679e3d..c49ace09eef0a 100644 --- a/Configuration/HLT/python/addOnTestsHLT.py +++ b/Configuration/HLT/python/addOnTestsHLT.py @@ -33,16 +33,16 @@ def addOnTestsHLT(): 'cmsDriver.py RelVal -s HLT:Fake2,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_Fake2 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016 --processName=HLTRECO --filein file:RelVal_Raw_Fake2_DATA.root --fileout file:RelVal_Raw_Fake2_DATA_HLT_RECO.root'], 'hlt_data_GRun' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_GRun --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_GRun_DATA.root --filein /store/data/Run2018D/EphemeralHLTPhysics1/RAW/v1/000/323/775/00000/2E066536-5CF2-B340-A73B-209640F29FF6.root --customise_commands=\'if hasattr(process,"simMuonGEMPadTask"): setattr(process,"simMuonGEMPadTask",cms.Task())\'', 'HLTrigger/Configuration/test/OnLine_HLT_GRun.py', - 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT,HLTrigger/Configuration/CustomConfigs.CTPPSRun2Geometry --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'], 'hlt_data_HIon' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_HIon --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_pp_on_PbPb --fileout file:RelVal_Raw_HIon_DATA.root --filein /store/data/Run2018D/HIMinimumBias0/RAW/v1/000/325/112/00000/660F62BB-9932-D645-A4A4-0BBBDA3963E8.root --customise_commands=\'if hasattr(process,"simMuonGEMPadTask"): setattr(process,"simMuonGEMPadTask",cms.Task()); from FWCore.ParameterSet.MassReplace import massSearchReplaceAnyInputTag; massSearchReplaceAnyInputTag(process.SimL1Emulator,"rawDataCollector","rawDataRepacker",False,True)\'', 'HLTrigger/Configuration/test/OnLine_HLT_HIon.py', - 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3_pp_on_PbPb --processName=HLTRECO --filein file:RelVal_Raw_HIon_DATA.root --fileout file:RelVal_Raw_HIon_DATA_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT,HLTrigger/Configuration/CustomConfigs.CTPPSRun2Geometry --era Run3_pp_on_PbPb --processName=HLTRECO --filein file:RelVal_Raw_HIon_DATA.root --fileout file:RelVal_Raw_HIon_DATA_HLT_RECO.root'], 'hlt_data_PIon' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_PIon --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --eventcontent RAW --fileout file:RelVal_Raw_PIon_DATA.root --filein /store/data/Run2018D/EphemeralHLTPhysics1/RAW/v1/000/323/775/00000/2E066536-5CF2-B340-A73B-209640F29FF6.root --customise_commands=\'if hasattr(process,"simMuonGEMPadTask"): setattr(process,"simMuonGEMPadTask",cms.Task())\'', 'HLTrigger/Configuration/test/OnLine_HLT_PIon.py', - 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT,HLTrigger/Configuration/CustomConfigs.CTPPSRun2Geometry --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'], 'hlt_data_PRef' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_PRef --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --eventcontent RAW --fileout file:RelVal_Raw_PRef_DATA.root --filein /store/data/Run2018D/EphemeralHLTPhysics1/RAW/v1/000/323/775/00000/2E066536-5CF2-B340-A73B-209640F29FF6.root --customise_commands=\'if hasattr(process,"simMuonGEMPadTask"): setattr(process,"simMuonGEMPadTask",cms.Task())\'', 'HLTrigger/Configuration/test/OnLine_HLT_PRef.py', - 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PRef_DATA.root --fileout file:RelVal_Raw_PRef_DATA_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT,HLTrigger/Configuration/CustomConfigs.CTPPSRun2Geometry --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PRef_DATA.root --fileout file:RelVal_Raw_PRef_DATA_HLT_RECO.root'], } return addOnTestsHLT diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index bc96f79aa2f69..a4caaddabebfa 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -31,6 +31,14 @@ The offsets currently in use are: * 0.3: 0.1 + 0.2 * 0.4: LowPU tracking era, `Run2_2017_trackingLowPU` * 0.5: Pixel tracking only + 0.1 +* 0.501: Patatrack, pixel only quadruplets, on CPU +* 0.502: Patatrack, pixel only quadruplets, on GPU +* 0.505: Patatrack, pixel only triplets, on CPU +* 0.506: Patatrack, pixel only triplets, on GPU +* 0.511: Patatrack, ECAL only CPU +* 0.512: Patatrack, ECAL only GPU +* 0.521: Patatrack, HCAL only CPU +* 0.522: Patatrack, HCAL only GPU * 0.6: HE Collapse (old depth segmentation for 2018) * 0.7: trackingMkFit modifier * 0.8: BPH Parking (Run-2) @@ -52,10 +60,4 @@ The offsets currently in use are: * 0.911: DD4Hep * 0.101: Phase-2 aging, 1000fb-1 * 0.103: Phase-2 aging, 3000fb-1 -* 0.501: Patatrack, pixel only CPU -* 0.502: Patatrack, pixel only GPU -* 0.511: Patatrack, ECAL only CPU -* 0.512: Patatrack, ECAL only GPU -* 0.521: Patatrack, HCAL only CPU -* 0.522: Patatrack, HCAL only GPU * 0.9001: Sonic Triton diff --git a/Configuration/PyReleaseValidation/python/MatrixReader.py b/Configuration/PyReleaseValidation/python/MatrixReader.py index e67034266b47f..c2f9fd9fac47c 100644 --- a/Configuration/PyReleaseValidation/python/MatrixReader.py +++ b/Configuration/PyReleaseValidation/python/MatrixReader.py @@ -316,7 +316,7 @@ def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only= self.reset(what) - if self.what != 'all' and self.what not in matrixFile: + if self.what != 'all' and not any(el in matrixFile for el in self.what.split(",")): print("ignoring non-requested file",matrixFile) continue @@ -492,7 +492,7 @@ def createWorkFlows(self, fileNameIn): def prepare(self, useInput=None, refRel='', fromScratch=None): for matrixFile in self.files: - if self.what != 'all' and self.what not in matrixFile: + if self.what != 'all' and not any(el in matrixFile for el in self.what.split(",")): print("ignoring non-requested file",matrixFile) continue if self.what == 'all' and not self.filesDefault[matrixFile]: diff --git a/Configuration/PyReleaseValidation/python/relval_2017.py b/Configuration/PyReleaseValidation/python/relval_2017.py index 0209452d59050..59f92409218f6 100644 --- a/Configuration/PyReleaseValidation/python/relval_2017.py +++ b/Configuration/PyReleaseValidation/python/relval_2017.py @@ -1,4 +1,3 @@ - # import the definition of the steps and input files: from Configuration.PyReleaseValidation.relval_steps import * @@ -24,16 +23,16 @@ # (HE collapse: TTbar, TTbar PU, TTbar design) # (ParkingBPH: TTbar) # (TTbar PU with JME NanoAOD) -# (Patatrack pixel-only: ZMM - on CPU) -# (Patatrack pixel-only: TTbar - on CPU) +# (Patatrack pixel-only: ZMM - on CPU: quadruplets, triplets) +# (Patatrack pixel-only: TTbar - on CPU: quadruplets, triplets) # (Patatrack ECAL-only: TTbar - on CPU) # (Patatrack HCAL-only: TTbar - on CPU) # 2021 (DD4HEP: TTbar, ZMM) # (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat) # (ZMM, TTbar, ZEE, MinBias, TTbar PU, TTbar PU premix, ZEE PU, TTbar design, GluGluTo2Jets, GluGluTo2Jets PU) # (TTbar trackingOnly, pixelTrackingOnly, trackingMkFit, trackdnn) -# (Patatrack pixel-only: ZMM - on CPU) -# (Patatrack pixel-only: TTbar - on CPU) +# (Patatrack pixel-only: ZMM - on CPU: quadruplets, triplets) +# (Patatrack pixel-only: TTbar - on CPU: quadruplets, triplets) # (Patatrack ECAL-only: TTbar - on CPU) # (Patatrack HCAL-only: TTbar - on CPU) # (TTbar 0T, TTbar PU 0T) @@ -51,16 +50,16 @@ 10824.6,11024.6,11224.6, 10824.8, 11024.15, - 10842.501, - 10824.501, + 10842.501,10842.505, + 10824.501,10824.505, 10824.511, 10824.521, 11634.911, 11650.911, 11601.0,11602.0,11603.0,11604.0,11605.0,11606.0,11607.0,11608.0,11609.0,11630.0,11643.0, 11650.0,11634.0,11646.0,11640.0,11834.0,11834.99,11846.0,12034.0,11725.0,11925.0, 11634.1,11634.5,11634.7,11634.91, - 11650.501, - 11634.501, + 11650.501,11650.505, + 11634.501,11634.505, 11634.511, 11634.521, 11634.24,11834.24, diff --git a/Configuration/PyReleaseValidation/python/relval_2026.py b/Configuration/PyReleaseValidation/python/relval_2026.py index e78c3a0d7a88f..25ce480f6f3db 100644 --- a/Configuration/PyReleaseValidation/python/relval_2026.py +++ b/Configuration/PyReleaseValidation/python/relval_2026.py @@ -30,6 +30,9 @@ numWFIB.extend([35834.0]) #2026D79 numWFIB.extend([36234.0]) #2026D80 numWFIB.extend([36634.0]) #2026D81 +numWFIB.extend([37034.0]) #2026D82 +numWFIB.extend([37434.0]) #2026D83 +numWFIB.extend([37834.0]) #2026D84 for numWF in numWFIB: workflows[numWF] = _upgrade_workflows[numWF] diff --git a/Configuration/PyReleaseValidation/python/relval_gpu.py b/Configuration/PyReleaseValidation/python/relval_gpu.py index 4e49467a0e2e8..db417a2a94365 100644 --- a/Configuration/PyReleaseValidation/python/relval_gpu.py +++ b/Configuration/PyReleaseValidation/python/relval_gpu.py @@ -14,21 +14,29 @@ #just define all of them #WFs to run in IB: -# mc 2018 (Patatrack pixel-only: ZMM - on GPU, both CPU and GPU, auto) -# (Patatrack pixel-only: TTbar - on GPU, both CPU and GPU, auto) +# mc 2018 (Patatrack pixel-only quadruplets: ZMM - on GPU, both CPU and GPU, auto) +# (Patatrack pixel-only triplets: ZMM - on GPU, both CPU and GPU, auto) +# (Patatrack pixel-only quadruplets: TTbar - on GPU, both CPU and GPU, auto) +# (Patatrack pixel-only triplets: TTbar - on GPU, both CPU and GPU, auto) # (Patatrack ECAL-only: TTbar - on GPU, both CPU and GPU, auto) # (Patatrack HCAL-only: TTbar - on GPU, both CPU and GPU, auto) -# mc 2021 (Patatrack pixel-only: ZMM - on GPU, both CPU and GPU, auto) -# (Patatrack pixel-only: TTbar - on GPU, both CPU and GPU, auto) +# mc 2021 (Patatrack pixel-only quadruplets: ZMM - on GPU, both CPU and GPU, auto) +# (Patatrack pixel-only triplets: ZMM - on GPU, both CPU and GPU, auto) +# (Patatrack pixel-only quadruplets: TTbar - on GPU, both CPU and GPU, auto) +# (Patatrack pixel-only triplets: TTbar - on GPU, both CPU and GPU, auto) # (Patatrack ECAL-only: TTbar - on GPU, both CPU and GPU, auto) # (Patatrack HCAL-only: TTbar - on GPU, both CPU and GPU, auto) numWFIB = [ 10842.502, # 10842.503,10842.504, + 10842.506, # 10842.507,10842.508, 10824.502, # 10824.503,10824.504, + 10824.506, # 10824.507,10824.508, 10824.512, # 10824.513,10824.514, 10824.522, # 10824.523,10824.524, 11650.502, # 11650.503,11650.504, + 11650.506, # 11650.507,11650.508, 11634.502, # 11634.503,11634.504, + 11634.506, # 11634.507,11634.508, 11634.512, # 11634.513,11634.514, 11634.522, # 11634.523,11634.524 ] diff --git a/Configuration/PyReleaseValidation/python/relval_pileup.py b/Configuration/PyReleaseValidation/python/relval_pileup.py index be7d1e352a108..8f2fd8794c9d9 100644 --- a/Configuration/PyReleaseValidation/python/relval_pileup.py +++ b/Configuration/PyReleaseValidation/python/relval_pileup.py @@ -71,7 +71,6 @@ workflows[25215.18]=['',['GluGluHToGG_M125_Pow_MINLO_NNLOPS_py8_13UP18','Hadronizer_TuneCUETP8M1_13TeV_powhegEmissionVeto_2p_HToGG_M125_13UP18','DIGIUP18_PU25','RECOUP18_PU25','HARVESTUP18_PU25']] workflows[11024.2]=['',['TTbar_13UP18HEfailINPUT','DigiFullHEfail','RecoFullHEfail','HARVESTFullHEfail','NanoFullHEfail']] -workflows[11024.3]=['',['TTbar_13UP18BadHcalMitigINPUT','DigiFullBadHcalMitig','RecoFullBadHcalMitig','HARVESTFullBadHcalMitig','NanoFullBadHcalMitig']] #fastsim workflows[25400] = ['ZEE_13',["FS_ZEE_13_UP15_PU25","HARVESTUP15FS","MINIAODMCUP15FS"]] diff --git a/Configuration/PyReleaseValidation/python/relval_production.py b/Configuration/PyReleaseValidation/python/relval_production.py index fb193b7855ac9..a7bbc199faf7d 100644 --- a/Configuration/PyReleaseValidation/python/relval_production.py +++ b/Configuration/PyReleaseValidation/python/relval_production.py @@ -25,6 +25,7 @@ workflows[1040] = ['',['RunZeroBias2017F','TIER0RAWSIPIXELCAL','ALCASPLITSIPIXELCAL','ALCAHARVDSIPIXELCAL']] workflows[1040.1] = ['',['RunExpressPhy2017F','TIER0EXPSIPIXELCAL','ALCASPLITSIPIXELCAL','ALCAHARVDSIPIXELCAL']] +workflows[1041] = ['',['RunExpressPhy2017F','TIER0EXPPPSCAL','ALCASPLITPPSCAL','ALCAHARVDPPSCAL']] ## MC production test #workflows[1100] = [ '',[]] diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index e3abf667d608e..431062551de54 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -380,7 +380,6 @@ workflows[136.898] = ['',['RunParkingBPH2018B','HLTDR2_2018','RECODR2_2018reHLT_skimParkingBPH_Offline','HARVEST2018']] workflows[136.8642] = ['',['RunJetHT2018BHEfail','HLTDR2_2018','RECODR2_2018reHLT_skimJetHT_Prompt_HEfail','HARVEST2018_HEfail']] -workflows[136.8643] = ['',['RunJetHT2018BBadHcalMitig','HLTDR2_2018_BadHcalMitig','RECODR2_2018reHLT_skimJetHT_Prompt_BadHcalMitig','HARVEST2018_BadHcalMitig']] ### run 2018C ### workflows[136.873] = ['',['RunHLTPhy2018C','HLTDR2_2018','RECODR2_2018reHLT_Offline','HARVEST2018']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 54c56c1f41cab..b7973c29c2b45 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -438,7 +438,6 @@ steps['RunCharmonium2018B']={'INPUT':InputInfo(dataSet='/Charmonium/Run2018B-v1/RAW',label='2018B',events=100000,location='STD', ls=Run2018B)} steps['RunParkingBPH2018B']={'INPUT':InputInfo(dataSet='/ParkingBPH5/Run2018B-v1/RAW',label='2018B',events=100000,location='STD', ls=Run2018B_parkingBPH)} steps['RunJetHT2018BHEfail']={'INPUT':InputInfo(dataSet='/JetHT/Run2018B-v1/RAW',label='HEfail',events=100000,location='STD', ls=Run2018B)} -steps['RunJetHT2018BBadHcalMitig']={'INPUT':InputInfo(dataSet='/JetHT/Run2018B-v1/RAW',label='BadHcalMitig',events=100000,location='STD', ls=Run2018B)} #### run2 2018C #### Run2018C={319450: [[1, 100]]} @@ -710,7 +709,7 @@ def identitySim(wf): # FIXME: replace with AODSIM (more appropriate) steps['TTbar_13_reminiaod2017UL_INPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_10_6_4-PUpmx25ns_106X_mc2017_realistic_v6_rsb-v1/GEN-SIM-RECO',label='rmaod',location='STD')} steps['TTbar_13_reminiaod2018UL_INPUT']={'INPUT':InputInfo(dataSet='/RelValProdTTbar_13_pmx25ns/CMSSW_10_6_4-PUpmx25ns_106X_upgrade2018_realistic_v9-v1/AODSIM',label='rmaod',location='STD')} -# INPUT command for reminiAOD wfs on PbPb relval inputs +# INPUT command for reminiAOD wfs on PbPb relval inputs steps['HydjetQ_reminiaodPbPb2018_INPUT']={'INPUT':InputInfo(dataSet='/RelValHydjetQ_B12_5020GeV_2018_ppReco/CMSSW_10_3_3-PU_103X_upgrade2018_realistic_HI_v11-v1/GEN-SIM-RECO',label='rmaod',location='STD')} #input for a NANOAOD from MINIAOD workflow @@ -807,7 +806,6 @@ def identitySim(wf): # INPUT commands for 2018 wf steps['TTbar_13UP18INPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/%s/GEN-SIM'%(baseDataSetRelease[18],),location='STD')} steps['TTbar_13UP18HEfailINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/%s/GEN-SIM'%(baseDataSetRelease[18],),location='STD')} -steps['TTbar_13UP18BadHcalMitigINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/%s/GEN-SIM'%(baseDataSetRelease[18],),label='Mitig',location='STD')} steps['ZEE_13UP18INPUT']={'INPUT':InputInfo(dataSet='/RelValZEE_13/%s/GEN-SIM'%(baseDataSetRelease[18],),location='STD')} steps['ZMM_13UP18INPUT']={'INPUT':InputInfo(dataSet='/RelValZMM_13/%s/GEN-SIM'%(baseDataSetRelease[18],),location='STD')} steps['ZTT_13UP18INPUT']={'INPUT':InputInfo(dataSet='/RelValZTT_13/%s/GEN-SIM'%(baseDataSetRelease[18],),location='STD')} @@ -1879,7 +1877,6 @@ def lhegensim2018ml(fragment,howMuch): steps['HLTDR2_2018_hBStar']=merge( [ {'--era' : 'Run2_2018_highBetaStar'},steps['HLTDR2_2018'] ] ) -steps['HLTDR2_2018_BadHcalMitig']=merge( [ {'--era' : 'Run2_2018,pf_badHcalMitigation'},steps['HLTDR2_2018'] ] ) # use --era steps['RECODR2_50ns']=merge([{'--scenario':'pp','--conditions':'auto:run2_data_relval','--era':'Run2_50ns',},dataReco]) @@ -2068,6 +2065,16 @@ def lhegensim2018ml(fragment,howMuch): '--eventcontent':'ALCARECO', } +steps['TIER0EXPPPSCAL']={'-s':'RAW2DIGI,L1Reco,ALCAPRODUCER:PPSCalTrackBasedSel,ENDJOB', + '--process':'ALCARECO', + '--scenario': 'pp', + '--era':'Run2_2017', + '--conditions':'auto:run2_data', + '--data': '', + '--datatier':'ALCARECO', + '--eventcontent':'ALCARECO', + } + steps['ALCASPLITHPBS']={'-s':'ALCAOUTPUT:TkAlMinBias,ALCA:PromptCalibProdBeamSpotHP+PromptCalibProdBeamSpotHPLowPU', '--scenario':'pp', '--data':'', @@ -2089,6 +2096,16 @@ def lhegensim2018ml(fragment,howMuch): #'--filein':'file:step2.root' } +steps['ALCASPLITPPSCAL']={'-s':'ALCAOUTPUT:PPSCalTrackBasedSel,ALCA:PPSTimingCalib', + '--scenario':'pp', + '--data':'', + '--era':'Run2_2017', + '--datatier':'ALCARECO', + '--eventcontent':'ALCARECO', + '--conditions':'auto:run2_data', + '--triggerResultsProcess':'RECO', + } + steps['ALCAHARVDHPBS']={'-s':'ALCAHARVEST:%s'%(autoPCL['PromptCalibProdBeamSpotHP']), #'--conditions':'auto:run2_data_promptlike', '--conditions':'auto:run3_data_express', # to replaced with line above once run2_data_promptlike will contain DropBoxMetadata @@ -2121,6 +2138,13 @@ def lhegensim2018ml(fragment,howMuch): '--data':'', '--filein':'file:PromptCalibProdSiPixel.root'} +steps['ALCAHARVDPPSCAL']={'-s':'ALCAHARVEST:%s'%(autoPCL['PromptCalibProdPPS']), + '--conditions':'auto:run3_data_express', + '--scenario':'pp', + '--data':'', + '--era':'Run2_2017', + '--filein':'file:PPSTimingCalib.root'} + steps['RECOCOSD']=merge([{'--scenario':'cosmics', '-s':'RAW2DIGI,L1Reco,RECO,DQM', '--datatier':'RECO,DQMIO', # no miniAOD for cosmics @@ -2186,8 +2210,11 @@ def gen2021HiMix(fragment,howMuch): '--era' :'Run2_2016' } -step3_pixelNtupleFit = { - '--procModifiers': 'pixelNtupleFit', +step3_pixel_ntuplet_cpu = { + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' +} +step3_pixel_triplets = { + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' } step3_gpu = { '--procModifiers': 'gpu', @@ -2246,15 +2273,15 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2017reHLTSiPixelCalZeroBias']=merge([{'--hltProcess':'reHLT','--conditions':'auto:run2_data_relval','-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,ALCA:SiPixelCalZeroBias,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2017']]) steps['RECODR2_2018reHLTAlCaTkCosmics']=merge([{'--hltProcess':'reHLT','--conditions':'auto:run2_data_relval','-s':'RAW2DIGI,L1Reco,RECO,SKIM:EXONoBPTXSkim,EI,PAT,ALCA:TkAlCosmicsInCollisions,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2018']]) -steps['RECODR2_2016reHLT_skimSingleMu']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TMuon'},steps['RECODR2_2016reHLT']]) +steps['RECODR2_2016reHLT_skimSingleMu']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TMuon'},steps['RECODR2_2016reHLT']]) steps['RECODR2_2016reHLT_skimDoubleEG']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:ZElectron,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) -steps['RECODR2_2016reHLT_skimMuonEG']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:TopMuEG,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) +steps['RECODR2_2016reHLT_skimMuonEG']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:TopMuEG,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) steps['RECODR2_2016reHLT_skimJetHT']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:JetHTJetPlusHOFilter,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) steps['RECODR2_2016reHLT_skimMET']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:HighMET+EXOMONOPOLE,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) steps['RECODR2_2016reHLT_skimSinglePh']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:SinglePhotonJetPlusHOFilter+EXOMONOPOLE,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) steps['RECODR2_2016reHLT_skimMuOnia']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:BPHSkim,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2016reHLT']]) -steps['RECODR2_2017reHLT_skimSingleMu']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TMuon'},steps['RECODR2_2017reHLT']]) +steps['RECODR2_2017reHLT_skimSingleMu']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TMuon'},steps['RECODR2_2017reHLT']]) steps['RECODR2_2017reHLT_skimDoubleEG']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:ZElectron,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2017reHLT']]) steps['RECODR2_2017reHLT_skimMuonEG']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:TopMuEG,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2017reHLT']]) steps['RECODR2_2017reHLT_skimJetHT']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:JetHTJetPlusHOFilter,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2017reHLT']]) @@ -2265,7 +2292,7 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2017reHLT_skimCharmonium']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGJPsiSkim+BPHSkim,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2017reHLT']]) steps['RECODR2_2018reHLT']=merge([{'--hltProcess':'reHLT','--conditions':'auto:run2_data_relval'},steps['RECODR2_2018']]) -steps['RECODR2_2018reHLT_skimSingleMu']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+SiStripCalSmallBiasScan+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TMuon'},steps['RECODR2_2018reHLT']]) +steps['RECODR2_2018reHLT_skimSingleMu']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+SiStripCalSmallBiasScan+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TMuon'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_skimEGamma_L1TEgDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:ZElectron+SinglePhotonJetPlusHOFilter+EXOMONOPOLE,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+SiStripCalSmallBiasScan+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@L1TEgamma'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_skimMuonEG']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:TopMuEG,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+SiStripCalSmallBiasScan+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_skimJetHT']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:JetHTJetPlusHOFilter,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+SiStripCalSmallBiasScan+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) @@ -2313,15 +2340,18 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2017reHLT_skimSinglePh_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2017reHLT_skimSinglePh']]) steps['RECODR2_2017reHLT_skimMuOnia_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2017reHLT_skimMuOnia']]) steps['RECODR2_2017reHLT_skimCharmonium_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2017reHLT_skimCharmonium']]) -steps['RECODR2_2017reHLT_skimSingleMu_Prompt_Lumi']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@lumi+@L1TMuon'},steps['RECODR2_2017reHLT_skimSingleMu_Prompt']]) +steps['RECODR2_2017reHLT_skimSingleMu_Prompt_Lumi']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@lumi+@L1TMuon'},steps['RECODR2_2017reHLT_skimSingleMu_Prompt']]) steps['RECODR2_2017reHLTAlCaTkCosmics_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2017reHLTAlCaTkCosmics']]) steps['RECODR2_2017reHLTSiPixelCalZeroBias_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2017reHLTSiPixelCalZeroBias']]) steps['RECODR2_2018reHLT_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_ZBPrompt']=merge([{'--conditions':'auto:run2_data','-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@rerecoZeroBias+@ExtraHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']=merge([{'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,DQM:@pixelTrackingOnlyDQM'},steps['RECODR2_2018reHLT_Prompt']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyCPU']=merge([step3_pixelNtupleFit, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyCPU']=merge([step3_pixel_ntuplet_cpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsCPU']=merge([step3_pixel_ntuplet_cpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) + steps['RECODR2_2018reHLT_ECALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,DQM:@ecalOnly'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_ECALOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_ECALOnlyCPU']]) steps['RECODR2_2018reHLT_HCALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,DQM:@hcalOnly+@hcal2Only'},steps['RECODR2_2018reHLT_Prompt']]) @@ -2346,15 +2376,13 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2018reHLT_skimCharmonium_Offline']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT_skimCharmonium']]) steps['RECODR2_2018reHLT_skimParkingBPH_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT_skimParkingBPH']]) steps['RECODR2_2018reHLT_skimParkingBPH_Offline']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT_skimParkingBPH']]) -steps['RECODR2_2018reHLT_skimSingleMu_Prompt_Lumi']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@lumi+@L1TMuon'},steps['RECODR2_2018reHLT_skimSingleMu_Prompt']]) -steps['RECODR2_2018reHLT_skimSingleMu_Offline_Lumi']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuon+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@lumi+@L1TMuon'},steps['RECODR2_2018reHLT_skimSingleMu_Offline']]) +steps['RECODR2_2018reHLT_skimSingleMu_Prompt_Lumi']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@lumi+@L1TMuon'},steps['RECODR2_2018reHLT_skimSingleMu_Prompt']]) +steps['RECODR2_2018reHLT_skimSingleMu_Offline_Lumi']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:MuonPOGSkim+ZMu+MuTau,EI,PAT,ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM+@lumi+@L1TMuon'},steps['RECODR2_2018reHLT_skimSingleMu_Offline']]) steps['RECODR2_2018reHLTAlCaTkCosmics_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLTAlCaTkCosmics']]) steps['RECODR2_2018reHLTAlCaTkCosmics_Offline']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLTAlCaTkCosmics']]) steps['RECODR2_2018reHLT_Prompt_hBStar']=merge([{'--era':'Run2_2018_highBetaStar'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_Offline_hBStar']=merge([{'--era':'Run2_2018_highBetaStar'},steps['RECODR2_2018reHLT_Offline']]) steps['RECODR2_2018reHLT_skimJetHT_Prompt_HEfail']=merge([{'--conditions':'auto:run2_data_HEfail'},steps['RECODR2_2018reHLT_skimJetHT']]) -steps['RECODR2_2018reHLT_skimJetHT_Prompt_BadHcalMitig']=merge([{'--conditions':'auto:run2_data_HEfail','--era':'Run2_2018,pf_badHcalMitigation'},steps['RECODR2_2018reHLT_skimJetHT']]) - steps['RECO']=merge([step3Defaults]) @@ -2712,7 +2740,6 @@ def gen2021HiMix(fragment,howMuch): steps['HARVEST2018_HCALOnly'] = merge([ {'-s':'HARVESTING:@hcalOnly'}, steps['HARVEST2018'] ]) steps['HARVEST2018_hBStar'] = merge([ {'--era' : 'Run2_2018_highBetaStar'}, steps['HARVEST2018'] ]) steps['HARVEST2018_HEfail'] = merge([ {'--conditions':'auto:run2_data_HEfail'}, steps['HARVEST2018'] ]) -steps['HARVEST2018_BadHcalMitig'] = merge([ {'--era' : 'Run2_2018,pf_badHcalMitigation','--conditions':'auto:run2_data_HEfail'}, steps['HARVEST2018'] ]) steps['HARVEST2018_L1TEgDQM_MULTIRUN'] = merge([ { '--customise':"Configuration/StandardSequences/DQMSaverAtJobEnd_cff", @@ -3202,10 +3229,6 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'NANOAODSIM', '--eventcontent':'NANOEDMAODSIM', '--filein':'file:step3_inMINIAODSIM.root'} -steps['DigiFullBadHcalMitig']=merge([{'--era' : 'Run2_2018,pf_badHcalMitigation'}, steps['DigiFullHEfail']]) -steps['RecoFullBadHcalMitig']=merge([{'--era' : 'Run2_2018,pf_badHcalMitigation'}, steps['RecoFullHEfail']]) -steps['HARVESTFullBadHcalMitig']=merge([{'--era' : 'Run2_2018,pf_badHcalMitigation'}, steps['HARVESTFullHEfail']]) -steps['NanoFullBadHcalMitig']=merge([{'--era' : 'Run2_2018,pf_badHcalMitigation'}, steps['NanoFullHEfail']]) ################################################################################# ####From this line till the end of the file : @@ -3388,7 +3411,7 @@ def gen2021HiMix(fragment,howMuch): upgradeStepDict['HARVESTGlobal'][k] = merge([{'-s': 'HARVESTING:@phase2Validation+@phase2+@miniAODValidation+@miniAODDQM'}, upgradeStepDict['HARVEST'][k]]) - upgradeStepDict['ALCA'][k] = {'-s':'ALCA:SiPixelCalSingleMuon+TkAlMuonIsolated+TkAlMinBias+MuAlOverlaps+EcalESAlign+TkAlZMuMu+HcalCalHBHEMuonFilter+TkAlUpsilonMuMu+TkAlJpsiMuMu+SiStripCalMinBias', + upgradeStepDict['ALCA'][k] = {'-s':'ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+TkAlMuonIsolated+TkAlMinBias+MuAlOverlaps+EcalESAlign+TkAlZMuMu+HcalCalHBHEMuonFilter+TkAlUpsilonMuMu+TkAlJpsiMuMu+SiStripCalMinBias', '--conditions':gt, '--datatier':'ALCARECO', '-n':'10', diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index fdb422f101976..07bfb1bc8ba56 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -48,6 +48,12 @@ '2026D80PU', '2026D81', '2026D81PU', + '2026D82', + '2026D82PU', + '2026D83', + '2026D83PU', + '2026D84', + '2026D84PU', ] # pre-generation of WF numbers @@ -435,7 +441,26 @@ def condition_(self, fragment, stepList, key, hasHarvest): '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--datatier': 'GEN-SIM-RECO,DQMIO', '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'pixelNtupleFit' + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' +} + +upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = UpgradeWorkflowPatatrack_PixelOnlyCPU( + steps = [ + 'Reco', + 'HARVEST', + 'RecoGlobal', + 'HARVESTGlobal', + ], + PU = [], + suffix = 'Patatrack_PixelOnlyTripletsCPU', + offset = 0.505, +) + +upgradeWFs['PatatrackPixelOnlyTripletsCPU'].step3 = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--datatier': 'GEN-SIM-RECO,DQMIO', + '--eventcontent': 'RECOSIM,DQM', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU,RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' } class UpgradeWorkflowPatatrack_PixelOnlyGPU(UpgradeWorkflowPatatrack): @@ -469,6 +494,26 @@ def condition_(self, fragment, stepList, key, hasHarvest): '--procModifiers': 'gpu' } +upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = UpgradeWorkflowPatatrack_PixelOnlyGPU( + steps = [ + 'Reco', + 'HARVEST', + 'RecoGlobal', + 'HARVESTGlobal', + ], + PU = [], + suffix = 'Patatrack_PixelOnlyTripletsGPU', + offset = 0.506, +) + +upgradeWFs['PatatrackPixelOnlyTripletsGPU'].step3 = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--datatier': 'GEN-SIM-RECO,DQMIO', + '--eventcontent': 'RECOSIM,DQM', + '--procModifiers': 'gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' +} + class UpgradeWorkflowPatatrack_ECALOnlyCPU(UpgradeWorkflowPatatrack): def setup_(self, step, stepName, stepDict, k, properties): if 'Reco' in step: @@ -1218,6 +1263,27 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Era' : 'Phase2C11I13T26M9', # customized for square pixels and Muon M9 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], }, + '2026D82' : { + 'Geom' : 'Extended2026D82', + 'HLTmenu': '@fake2', + 'GT' : 'auto:phase2_realistic_T21', + 'Era' : 'Phase2C11I13M9', + 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], + }, + '2026D83' : { + 'Geom' : 'Extended2026D83', + 'HLTmenu': '@fake2', + 'GT' : 'auto:phase2_realistic_T21', + 'Era' : 'Phase2C11I13M9', + 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], + }, + '2026D84' : { + 'Geom' : 'Extended2026D84', + 'HLTmenu': '@fake2', + 'GT' : 'auto:phase2_realistic_T21', + 'Era' : 'Phase2C11', + 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], + }, } # standard PU sequences diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 86fddf224cf6c..55d89e6913634 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -24,10 +24,13 @@ def runSelected(opt): # test for wrong input workflows if opt.testList: - definedSet = set([dwf.numId for dwf in mrd.workFlows]) + definedWf = [dwf.numId for dwf in mrd.workFlows] + definedSet = set(definedWf) testSet = set(opt.testList) undefSet = testSet - definedSet if len(undefSet)>0: raise ValueError('Undefined workflows: '+', '.join(map(str,list(undefSet)))) + duplicates = [wf for wf in testSet if definedWf.count(wf)>1 ] + if len(duplicates)>0: raise ValueError('Duplicated workflows: '+', '.join(map(str,list(duplicates)))) ret = 0 if opt.show: @@ -175,7 +178,7 @@ def runSelected(opt): default=None ) parser.add_option('-w','--what', - help='Specify the set to be used. Argument must be the name of the set (standard, pileup,...)', + help='Specify the set to be used. Argument must be the name of a set (standard, pileup,...) or multiple sets separated by commas (--what standard,pileup )', dest='what', default='all' ) diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index c35d814d4948d..41604bb588ed0 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -10,6 +10,7 @@ from Calibration.LumiAlCaRecoProducers.AlcaLumiPCCHarvester_cff import * from CalibTracker.SiPixelQuality.SiPixelStatusHarvester_cfi import * from CalibTracker.SiPixelQuality.DQMEventInfoSiPixelQuality_cff import * +from CalibPPS.TimingCalibration.PPSTimingCalibrationHarvester_cff import * from Calibration.TkAlCaRecoProducers.PCLMetadataWriter_cfi import * @@ -213,6 +214,15 @@ ) ALCAHARVESTSiPixelQuality_dbOutput.extend(dbOutput_ext) +# -------------------------------------------------------------------------------------- +# PPS calibration +ALCAHARVESTPPSTimingCalibration = ppsTimingCalibrationPCLHarvester.clone() +ALCAHARVESTPPSTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd')) +ALCAHARVESTPPSTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), + tag = cms.string('PPSDiamondTimingCalibration_pcl'), + timetype = cms.untracked.string('lumiid') + ) + # define all the paths BeamSpotByRun = cms.Path(ALCAHARVESTBeamSpotByRun) BeamSpotByLumi = cms.Path(ALCAHARVESTBeamSpotByLumi) @@ -227,6 +237,7 @@ SiStripGainsAAG = cms.Path(ALCAHARVESTSiStripGainsAAG) LumiPCC = cms.Path(ALCAHARVESTLumiPCC) SiPixelQuality = cms.Path(dqmEnvSiPixelQuality+ALCAHARVESTSiPixelQuality)#+siPixelPhase1DQMHarvester) +PPSTimingCalibration = cms.Path(ALCAHARVESTPPSTimingCalibration) ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(dqmSaver+pclMetadataWriter) diff --git a/Configuration/StandardSequences/python/AlCaRecoStreamsHeavyIons_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreamsHeavyIons_cff.py index 03eee48c24810..f36faf4d865f3 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreamsHeavyIons_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreamsHeavyIons_cff.py @@ -27,8 +27,10 @@ ############################################################### # Tracker Calibration ############################################################### -# AlCaReco for pixel calibration using muons +# AlCaReco for pixel calibration using muons from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuon_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuonLoose_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuonTight_cff import * # AlCaReco for tracker calibration using MinBias events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalMinBiasHI_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalMinBiasAAGHI_cff import * @@ -121,6 +123,8 @@ pathALCARECOTkAlUpsilonMuMuHI = cms.Path(seqALCARECOTkAlUpsilonMuMuHI*ALCARECOTkAlUpsilonMuMuHIDQM) pathALCARECOTkAlMinBiasHI = cms.Path(seqALCARECOTkAlMinBiasHI*ALCARECOTkAlMinBiasHIDQM) pathALCARECOSiPixelCalSingleMuon = cms.Path(seqALCARECOSiPixelCalSingleMuon) +pathALCARECOSiPixelCalSingleMuonLoose = cms.Path(seqALCARECOSiPixelCalSingleMuonLoose) +pathALCARECOSiPixelCalSingleMuonTight = cms.Path(seqALCARECOSiPixelCalSingleMuonTight) pathALCARECOSiStripCalMinBias = cms.Path(seqALCARECOSiStripCalMinBias*ALCARECOSiStripCalMinBiasDQM) pathALCARECOSiStripCalMinBiasAAG = cms.Path(seqALCARECOSiStripCalMinBiasAAG*ALCARECOSiStripCalMinBiasAAGDQM) pathALCARECOSiStripCalCosmics = cms.Path(seqALCARECOSiStripCalCosmics) @@ -231,6 +235,24 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamSiPixelCalSingleMuonTight = cms.FilteredStream( + responsible = 'Marco Musich', + name = 'SiPixelCalSingleMuonTight', + paths = (pathALCARECOSiPixelCalSingleMuonTight), + content = OutALCARECOSiPixelCalSingleMuonTight.outputCommands, + selectEvents = OutALCARECOSiPixelCalSingleMuonTight.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + +ALCARECOStreamSiPixelCalSingleMuonLoose = cms.FilteredStream( + responsible = 'Marco Musich', + name = 'SiPixelCalSingleMuonLoose', + paths = (pathALCARECOSiPixelCalSingleMuonLoose), + content = OutALCARECOSiPixelCalSingleMuonLoose.outputCommands, + selectEvents = OutALCARECOSiPixelCalSingleMuonLoose.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamSiStripCalMinBias = cms.FilteredStream( responsible = 'Vitaliano Ciulli', name = 'SiStripCalMinBias', diff --git a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index 00806b7280dda..1ff1ca78ca02c 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -35,6 +35,8 @@ ############################################################### # AlCaReco for pixel calibration using muons from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuon_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuonLoose_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalSingleMuonTight_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalCosmics_cff import * # AlCaReco for tracker calibration using MinBias events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalMinBias_cff import * @@ -45,7 +47,7 @@ from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalZeroBias_cff import * # AlCaReco for SiPixel Bad Components using ZeroBias events in ExpressPhysics stream from CalibTracker.SiPixelQuality.ALCARECOSiPixelCalZeroBias_cff import * -# AlCaReco for tracker calibration using Cosmics events +# AlCaReco for tracker calibration using Cosmics events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_cff import * ############################################################### @@ -117,6 +119,12 @@ ############################################################### from CalibMuon.RPCCalibration.ALCARECORpcCalHLT_cff import * +############################################################### +# PPS calibration +############################################################### +# Timing calibration +from CalibPPS.TimingCalibration.ALCARECOPPSCalTrackBasedSel_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSTimingCalib_cff import * ############################################################### # nonbeam alcas @@ -166,6 +174,8 @@ pathALCARECOTkAlMinBias = cms.Path(seqALCARECOTkAlMinBias*ALCARECOTkAlMinBiasDQM) pathALCARECOTkAlMinBias = cms.Path(seqALCARECOTkAlMinBias*ALCARECOTkAlMinBiasDQM) pathALCARECOSiPixelCalSingleMuon = cms.Path(seqALCARECOSiPixelCalSingleMuon) +pathALCARECOSiPixelCalSingleMuonLoose = cms.Path(seqALCARECOSiPixelCalSingleMuonLoose) +pathALCARECOSiPixelCalSingleMuonTight = cms.Path(seqALCARECOSiPixelCalSingleMuonTight) pathALCARECOSiPixelCalCosmics = cms.Path(seqALCARECOSiPixelCalCosmics) pathALCARECOSiStripCalMinBias = cms.Path(seqALCARECOSiStripCalMinBias*ALCARECOSiStripCalMinBiasDQM) pathALCARECOSiStripCalCosmics = cms.Path(seqALCARECOSiStripCalCosmics) @@ -178,6 +188,8 @@ pathALCARECOAlCaPCCZeroBiasFromRECO = cms.Path(seqALCARECOAlCaPCCZeroBiasFromRECO) pathALCARECOAlCaPCCRandomFromRECO = cms.Path(seqALCARECOAlCaPCCRandomFromRECO) +pathALCARECOPPSCalTrackBasedSel = cms.Path(seqALCARECOPPSCalTrackBasedSel) + #### ECAL pathALCARECOEcalCalZElectron = cms.Path(seqALCARECOEcalCalZElectron) pathALCARECOEcalCalZSCElectron = cms.Path(seqALCARECOEcalCalZSCElectron) @@ -213,6 +225,7 @@ pathALCARECOMuAlOverlaps = cms.Path(seqALCARECOMuAlOverlaps) pathALCARECOMuAlOverlapsGeneralTracks = cms.Path(seqALCARECOMuAlOverlapsGeneralTracks) pathALCARECORpcCalHLT = cms.Path(seqALCARECORpcCalHLT) +pathALCARECOPPSTimingCalib = cms.Path(taskALCARECOPPSTimingCalib) pathALCARECOTkAlBeamHalo = cms.Path(seqALCARECOTkAlBeamHalo*ALCARECOTkAlBeamHaloDQM) pathALCARECOMuAlBeamHaloOverlaps = cms.Path(seqALCARECOMuAlBeamHaloOverlaps) pathALCARECOMuAlBeamHalo = cms.Path(seqALCARECOMuAlBeamHalo) @@ -351,6 +364,24 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamSiPixelCalSingleMuonLoose = cms.FilteredStream( + responsible = 'Marco Musich', + name = 'SiPixelCalSingleMuonLoose', + paths = (pathALCARECOSiPixelCalSingleMuonLoose), + content = OutALCARECOSiPixelCalSingleMuonLoose.outputCommands, + selectEvents = OutALCARECOSiPixelCalSingleMuonLoose.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + +ALCARECOStreamSiPixelCalSingleMuonTight = cms.FilteredStream( + responsible = 'Marco Musich', + name = 'SiPixelCalSingleMuonTight', + paths = (pathALCARECOSiPixelCalSingleMuonTight), + content = OutALCARECOSiPixelCalSingleMuonTight.outputCommands, + selectEvents = OutALCARECOSiPixelCalSingleMuonTight.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamSiPixelCalCosmics = cms.FilteredStream( responsible = 'Tamas Almos Vami', name = 'SiPixelCalCosmics', @@ -441,6 +472,15 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamPPSCalTrackBasedSel = cms.FilteredStream( + responsible = 'Laurent Forthomme', + name = 'PPSCalTrackBasedSel', + paths = (pathALCARECOPPSCalTrackBasedSel), + content = OutALCARECOPPSCalTrackBasedSel.outputCommands, + selectEvents = OutALCARECOPPSCalTrackBasedSel.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamEcalCalZElectron = cms.FilteredStream( responsible = 'Shervin Nourbakhsh', name = 'EcalCalZElectron', @@ -773,6 +813,14 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamPPSTimingCalib = cms.FilteredStream( + responsible = 'Laurent Forthomme', + name = 'PPSTimingCalib', + paths = (pathALCARECOPPSTimingCalib), + content = OutALCARECOPPSTimingCalib.outputCommands, + selectEvents = OutALCARECOPPSTimingCalib.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) ALCARECOStreamPromptCalibProd = cms.FilteredStream( responsible = 'Gianluca Cerminara', diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 373bd11296bb8..585d3d7c67250 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -69,8 +69,8 @@ def __init__(self): 'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel', 'phase2_trigger', 'phase2_squarePixels', 'phase2_3DPixels', - 'trackingLowPU', 'trackingPhase1', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2021', 'trackingPhase2PU140','highBetaStar_2018', - 'tracker_apv_vfp30_2016', 'pf_badHcalMitigation', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X', + 'trackingLowPU', 'trackingPhase1', 'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2021', 'trackingPhase2PU140','highBetaStar_2018', + 'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X', 'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016', 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', 'hcalHardcodeConditions', 'hcalSkipPacker', diff --git a/Configuration/StandardSequences/python/GeometryConf.py b/Configuration/StandardSequences/python/GeometryConf.py index 329ec6ef388da..edf77e17bb6c0 100644 --- a/Configuration/StandardSequences/python/GeometryConf.py +++ b/Configuration/StandardSequences/python/GeometryConf.py @@ -60,4 +60,7 @@ 'Extended2026D79' : 'Extended2026D79,Extended2026D79Reco', 'Extended2026D80' : 'Extended2026D80,Extended2026D80Reco', 'Extended2026D81' : 'Extended2026D81,Extended2026D81Reco', + 'Extended2026D82' : 'Extended2026D82,Extended2026D82Reco', + 'Extended2026D83' : 'Extended2026D83,Extended2026D83Reco', + 'Extended2026D84' : 'Extended2026D84,Extended2026D84Reco', } diff --git a/Configuration/StandardSequences/python/RawToDigi_cff.py b/Configuration/StandardSequences/python/RawToDigi_cff.py index 102e8b1132f71..42fa09bd30c62 100644 --- a/Configuration/StandardSequences/python/RawToDigi_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_cff.py @@ -92,15 +92,15 @@ # add CTPPS 2016 raw-to-digi modules -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_cff import ctpps -_ctpps_2016_RawToDigiTask = RawToDigiTask.copy() -_ctpps_2016_RawToDigiTask.add(ctppsRawToDigiTask) -ctpps_2016.toReplaceWith(RawToDigiTask, _ctpps_2016_RawToDigiTask) +_ctpps_RawToDigiTask = RawToDigiTask.copy() +_ctpps_RawToDigiTask.add(ctppsRawToDigiTask) +ctpps.toReplaceWith(RawToDigiTask, _ctpps_RawToDigiTask) -_ctpps_2016_RawToDigiTask_noTk = RawToDigiTask_noTk.copy() -_ctpps_2016_RawToDigiTask_noTk.add(ctppsRawToDigiTask) -ctpps_2016.toReplaceWith(RawToDigiTask_noTk, _ctpps_2016_RawToDigiTask_noTk) +_ctpps_RawToDigiTask_noTk = RawToDigiTask_noTk.copy() +_ctpps_RawToDigiTask_noTk.add(ctppsRawToDigiTask) +ctpps.toReplaceWith(RawToDigiTask_noTk, _ctpps_RawToDigiTask_noTk) # GEM settings _gem_RawToDigiTask = RawToDigiTask.copy() diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index 1bc338526c4a6..e03d228a857fb 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -75,14 +75,15 @@ phase2_timing_layer.toReplaceWith(localrecoTask,_phase2_timing_layer_localrecoTask) phase2_timing_layer.toReplaceWith(localreco_HcalNZSTask,_phase2_timing_layer_localreco_HcalNZSTask) -_ctpps_2016_localrecoTask = localrecoTask.copy() -_ctpps_2016_localrecoTask.add(recoCTPPSTask) -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -ctpps_2016.toReplaceWith(localrecoTask, _ctpps_2016_localrecoTask) - -_ctpps_2016_localreco_HcalNZSTask = localreco_HcalNZSTask.copy() -_ctpps_2016_localreco_HcalNZSTask.add(recoCTPPSTask) -ctpps_2016.toReplaceWith(localreco_HcalNZSTask, _ctpps_2016_localreco_HcalNZSTask) +from Configuration.Eras.Modifier_ctpps_cff import ctpps + +_ctpps_localrecoTask = localrecoTask.copy() +_ctpps_localrecoTask.add(recoCTPPSTask) +ctpps.toReplaceWith(localrecoTask, _ctpps_localrecoTask) + +_ctpps_localreco_HcalNZSTask = localreco_HcalNZSTask.copy() +_ctpps_localreco_HcalNZSTask.add(recoCTPPSTask) +ctpps.toReplaceWith(localreco_HcalNZSTask, _ctpps_localreco_HcalNZSTask) ########################################### # no castor, zdc, Totem/CTPPS RP in FastSim diff --git a/DQM/CTPPS/python/ctppsDQM_cff.py b/DQM/CTPPS/python/ctppsDQM_cff.py index e6f9fdf5969a3..64ecae982a47a 100644 --- a/DQM/CTPPS/python/ctppsDQM_cff.py +++ b/DQM/CTPPS/python/ctppsDQM_cff.py @@ -60,19 +60,19 @@ ) # the actually used sequences must be empty for pre-PPS data -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_cff import ctpps ctppsDQMOnlineSource = cms.Sequence() ctppsDQMOnlineHarvest = cms.Sequence() -ctpps_2016.toReplaceWith(ctppsDQMOnlineSource, _ctppsDQMOnlineSource) -ctpps_2016.toReplaceWith(ctppsDQMOnlineHarvest, _ctppsDQMOnlineHarvest) +ctpps.toReplaceWith(ctppsDQMOnlineSource, _ctppsDQMOnlineSource) +ctpps.toReplaceWith(ctppsDQMOnlineHarvest, _ctppsDQMOnlineHarvest) ctppsDQMCalibrationSource = cms.Sequence() ctppsDQMCalibrationHarvest = cms.Sequence() -ctpps_2016.toReplaceWith(ctppsDQMCalibrationSource, _ctppsDQMCalibrationSource) -ctpps_2016.toReplaceWith(ctppsDQMCalibrationHarvest, _ctppsDQMCalibrationHarvest) +ctpps.toReplaceWith(ctppsDQMCalibrationSource, _ctppsDQMCalibrationSource) +ctpps.toReplaceWith(ctppsDQMCalibrationHarvest, _ctppsDQMCalibrationHarvest) ctppsDQMOfflineSource = cms.Sequence() ctppsDQMOfflineHarvest = cms.Sequence() -ctpps_2016.toReplaceWith(ctppsDQMOfflineSource, _ctppsDQMOfflineSource) -ctpps_2016.toReplaceWith(ctppsDQMOfflineHarvest, _ctppsDQMOfflineHarvest) +ctpps.toReplaceWith(ctppsDQMOfflineSource, _ctppsDQMOfflineSource) +ctpps.toReplaceWith(ctppsDQMOfflineHarvest, _ctppsDQMOfflineHarvest) diff --git a/DQM/CTPPS/test/all_ctpps_dqm_test_from_aod_cfg.py b/DQM/CTPPS/test/all_ctpps_dqm_test_from_aod_cfg.py index 2ba84dc9f8f79..66b0c33de5388 100644 --- a/DQM/CTPPS/test/all_ctpps_dqm_test_from_aod_cfg.py +++ b/DQM/CTPPS/test/all_ctpps_dqm_test_from_aod_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -process = cms.Process('ctppsDQMfromAOD', ctpps_2016) +from Configuration.Eras.Modifier_ctpps_cff import ctpps +process = cms.Process('ctppsDQMfromAOD', ctpps) # minimum of logs process.MessageLogger = cms.Service("MessageLogger", diff --git a/DQM/CTPPS/test/all_ctpps_dqm_test_from_dat_cfg.py b/DQM/CTPPS/test/all_ctpps_dqm_test_from_dat_cfg.py index 251413f07c951..920a6690418ec 100644 --- a/DQM/CTPPS/test/all_ctpps_dqm_test_from_dat_cfg.py +++ b/DQM/CTPPS/test/all_ctpps_dqm_test_from_dat_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -process = cms.Process('ctppsDQMfromRAW', ctpps_2016) +from Configuration.Eras.Modifier_ctpps_cff import ctpps +process = cms.Process('ctppsDQMfromRAW', ctpps) # minimum of logs process.MessageLogger = cms.Service("MessageLogger", diff --git a/DQM/CTPPS/test/all_ctpps_dqm_test_from_raw_cfg.py b/DQM/CTPPS/test/all_ctpps_dqm_test_from_raw_cfg.py index a7fb39a678b5e..ffe53729359b7 100644 --- a/DQM/CTPPS/test/all_ctpps_dqm_test_from_raw_cfg.py +++ b/DQM/CTPPS/test/all_ctpps_dqm_test_from_raw_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -process = cms.Process('ctppsDQMfromRAW', ctpps_2016) +from Configuration.Eras.Modifier_ctpps_cff import ctpps +process = cms.Process('ctppsDQMfromRAW', ctpps) # minimum of logs process.MessageLogger = cms.Service("MessageLogger", diff --git a/DQM/DTMonitorModule/python/dtDigiTask_TP_cfi.py b/DQM/DTMonitorModule/python/dtDigiTask_TP_cfi.py index b35cb72b389e3..c0b5db3d08fe3 100644 --- a/DQM/DTMonitorModule/python/dtDigiTask_TP_cfi.py +++ b/DQM/DTMonitorModule/python/dtDigiTask_TP_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms - from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer dtTPmonitor = DQMEDAnalyzer('DTDigiTask', # set the max TDC counts for the time-box (6400 or 1600) @@ -35,8 +34,8 @@ testPulseMode = cms.untracked.bool(True), # switch on the mode for running on slice test (different top folder and customizations) sliceTestMode = cms.untracked.bool(False), - # time pedestal to be subtracted if sliceTestMode is true - tdcPedestal = cms.untracked.int32(105100), + # time pedestal defining the lower edge of the timebox plots + tdcPedestal = cms.untracked.int32(0), # switch for filtering on synch noise events (threshold on # of digis per chamber) filterSyncNoise = cms.untracked.bool(False), # threshold on # of digis per chamber to define sync noise diff --git a/DQM/DTMonitorModule/python/dtDigiTask_cfi.py b/DQM/DTMonitorModule/python/dtDigiTask_cfi.py index 6a9a4510d7408..cd4f098a34a45 100644 --- a/DQM/DTMonitorModule/python/dtDigiTask_cfi.py +++ b/DQM/DTMonitorModule/python/dtDigiTask_cfi.py @@ -34,8 +34,8 @@ testPulseMode = cms.untracked.bool(False), # switch on the mode for running on slice test (different top folder and customizations) sliceTestMode = cms.untracked.bool(False), - # time pedestal to be subtracted if sliceTestMode is true - tdcPedestal = cms.untracked.int32(105100), + # time pedestal defining the lower edge of the timebox plots + tdcPedestal = cms.untracked.int32(0), # switch for filtering on synch noise events (threshold on # of digis per chamber) filterSyncNoise = cms.untracked.bool(False), # look for synch noise events diff --git a/DQM/DTMonitorModule/python/dtTriggerBaseTask_cfi.py b/DQM/DTMonitorModule/python/dtTriggerBaseTask_cfi.py index 72451717b150a..d3ca5cb00fcc9 100644 --- a/DQM/DTMonitorModule/python/dtTriggerBaseTask_cfi.py +++ b/DQM/DTMonitorModule/python/dtTriggerBaseTask_cfi.py @@ -7,6 +7,7 @@ targetBXTM = cms.untracked.int32(0), bestTrigAccRange = cms.untracked.int32(3), processTM = cms.untracked.bool(True), + processAB7 = cms.untracked.bool(False), nTimeBins = cms.untracked.int32(100), nLSTimeBin = cms.untracked.int32(15), ResetCycle = cms.untracked.int32(9999), @@ -14,8 +15,11 @@ inputTagTMphIn = cms.untracked.InputTag('twinMuxStage2Digis:PhIn'), inputTagTMphOut = cms.untracked.InputTag('twinMuxStage2Digis:PhOut'), inputTagTMth = cms.untracked.InputTag('twinMuxStage2Digis:ThIn'), + inputTagAB7 = cms.untracked.InputTag('dtAB7Unpacker'), minBXTM = cms.untracked.int32(-2), - maxBXTM = cms.untracked.int32(2) + maxBXTM = cms.untracked.int32(2), + minBXAB7 = cms.untracked.int32(-12), + maxBXAB7 = cms.untracked.int32(12) ) diff --git a/DQM/DTMonitorModule/python/slice_test_customizations_cff.py b/DQM/DTMonitorModule/python/slice_test_customizations_cff.py index 100c7463af883..61152d2d71d69 100644 --- a/DQM/DTMonitorModule/python/slice_test_customizations_cff.py +++ b/DQM/DTMonitorModule/python/slice_test_customizations_cff.py @@ -1,9 +1,14 @@ from __future__ import print_function import FWCore.ParameterSet.Config as cms -def customise_for_slice_test(process): +def customise_for_slice_test(process, enableDigis, enableTPs): - print("[customise_for_slice_test]: cloning unpacker and DTDigiTask + customising AB7 sequence") + print("[customise_for_slice_test]: cloning unpacker and DTDigiTask + customising AB7 sequence and TP monitoring") + + # Firstly, increase the cut on # of digis/chamber + # to consider it noisy for the legacy DTDigiTask + + process.dtDigiMonitor.maxTDCHitsPerChamber = 5000 # This is commented out as the AB7 unpacker is not in CMSSW # at present, the following lines need to be uncommented in the P5 setup @@ -16,19 +21,31 @@ def customise_for_slice_test(process): from EventFilter.DTRawToDigi.dturosunpacker_cfi import dturosunpacker process.dtAB7Unpacker = dturosunpacker.clone() + + if hasattr(process,"dtDQMTask"): + print("[customise_for_slice_test]: extending dtDQMTask sequence to include AB7 unpacker") + process.dtDQMTask.replace(process.dtDigiMonitor, process.dtDigiMonitor + + process.dtAB7Unpacker) + + if enableDigis: - from DQM.DTMonitorModule.dtDigiTask_cfi import dtDigiMonitor - process.dtAB7DigiMonitor = dtDigiMonitor.clone() + from DQM.DTMonitorModule.dtDigiTask_cfi import dtDigiMonitor + process.dtAB7DigiMonitor = dtDigiMonitor.clone() + + process.dtAB7DigiMonitor.dtDigiLabel = cms.InputTag("dtAB7Unpacker") + process.dtAB7DigiMonitor.sliceTestMode = True + process.dtAB7DigiMonitor.maxTDCHitsPerChamber = 5000 + + process.dtAB7DigiMonitor.performPerWireT0Calibration = False - process.dtAB7DigiMonitor.dtDigiLabel = cms.InputTag("dtAB7Unpacker") - process.dtAB7DigiMonitor.sliceTestMode = True + if hasattr(process,"dtAB7Unpacker"): + print("[customise_for_slice_test]: extending dtDQMTask sequence to include AB7 digi monitoring") + process.dtDQMTask.replace(process.dtAB7Unpacker, process.dtAB7Unpacker + + process.dtAB7DigiMonitor) - process.dtAB7DigiMonitor.performPerWireT0Calibration = False + if enableTPs: - if hasattr(process,"dtDQMTask") : - print("[customise_for_slice_test]: extending dtDQMTask sequence to include AB7 monitoring") - process.dtDQMTask.replace(process.dtDigiMonitor, process.dtDigiMonitor +\ - process.dtAB7Unpacker +\ - process.dtAB7DigiMonitor) + print("[customise_for_slice_test]: customise dtTriggerBaseMonitor to include AB7 TP monitoring") + process.dtTriggerBaseMonitor.processAB7 = True return process diff --git a/DQM/DTMonitorModule/python/test/dt_dqm_sourceclient-live_cfg.py b/DQM/DTMonitorModule/python/test/dt_dqm_sourceclient-live_cfg.py index ad8f2044b3f4c..27e21c9f6cb29 100644 --- a/DQM/DTMonitorModule/python/test/dt_dqm_sourceclient-live_cfg.py +++ b/DQM/DTMonitorModule/python/test/dt_dqm_sourceclient-live_cfg.py @@ -95,17 +95,17 @@ process = customise(process) ### DT slice test specific customisations -if (process.dtDqmConfig.getProcessAB7Digis()) : +if (process.dtDqmConfig.getProcessAB7Digis() or \ + process.dtDqmConfig.getProcessAB7TPs()) : from DQM.DTMonitorModule.slice_test_customizations_cff import * - process = customise_for_slice_test(process) + process = customise_for_slice_test(process, + process.dtDqmConfig.getProcessAB7Digis(), + process.dtDqmConfig.getProcessAB7TPs()) ### DT digi customisation if (process.dtDqmConfig.getRunWithLargeTB()) : process.dtDigiMonitor.maxTTMounts = 6400 if (process.dtDqmConfig.getProcessAB7Digis()) : - - if (process.dtDqmConfig.getRunWithLargeTB()) : - process.dtAB7DigiMonitor.maxTTMounts = 6400 - + process.dtAB7DigiMonitor.maxTTMounts = 6400 process.dtAB7DigiMonitor.tdcPedestal = process.dtDqmConfig.getTBTDCPedestal() diff --git a/DQM/DTMonitorModule/python/test/inputsource_live_cfi.py b/DQM/DTMonitorModule/python/test/inputsource_live_cfi.py index a1ec7c7edceb8..2e669174cbe7c 100644 --- a/DQM/DTMonitorModule/python/test/inputsource_live_cfi.py +++ b/DQM/DTMonitorModule/python/test/inputsource_live_cfi.py @@ -69,10 +69,10 @@ "Runs DTDigiTask with a timebox plot window of 6400 TDC Counts") options.register('timeBoxTDCPedestal', - 105100, # default value + -200, # default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, - "Pedestal to subtract to TDC counts for AB7") + "Pedestal of the lower edge of AB7 time boxes") options.parseArguments() @@ -92,6 +92,7 @@ if not options.inputFiles: # Input source + minEventsPerLumi = 1 nextLumiTimeoutMillis = 240000 endOfRunKills = True diff --git a/DQM/DTMonitorModule/src/DTDigiTask.cc b/DQM/DTMonitorModule/src/DTDigiTask.cc index f9d770ab0bf54..84ee9290342d7 100644 --- a/DQM/DTMonitorModule/src/DTDigiTask.cc +++ b/DQM/DTMonitorModule/src/DTDigiTask.cc @@ -88,8 +88,8 @@ DTDigiTask::DTDigiTask(const edm::ParameterSet& ps) { // switch on the mode for running on slice test (different top folder and other customizations) sliceTestMode = ps.getUntrackedParameter("sliceTestMode", false); - // time pedestal to be subtracted if sliceTestMode is true - tdcPedestal = ps.getUntrackedParameter("tdcPedestal", 105100); + // time pedestal used to set the minimum in the time box plot + tdcPedestal = ps.getUntrackedParameter("tdcPedestal", 0); // switch on production of time-boxes with layer granularity doLayerTimeBoxes = ps.getUntrackedParameter("doLayerTimeBoxes", false); @@ -132,6 +132,9 @@ void DTDigiTask::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& run, nEventMonitor = ibooker.bookFloat(tpMode ? "nProcessedEventsDigiTP" : "nProcessedEventsDigi"); ibooker.setCurrentFolder(topFolder()); for (int wh = -2; wh <= 2; ++wh) { // loop over wheels + if (sliceTestMode && wh != 2) + continue; + if (doAllHitsOccupancies) bookHistos(ibooker, wh, string("Occupancies"), "OccupancyAllHits"); @@ -149,6 +152,10 @@ void DTDigiTask::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& run, for (int sect = 1; sect <= 14; ++sect) { // loop over sectors if ((sect == 13 || sect == 14) && st != 4) continue; + + if (sliceTestMode && (sect != 12 || wh != 2)) + continue; + // Get the chamber ID const DTChamberId dtChId(wh, st, sect); @@ -205,6 +212,9 @@ void DTDigiTask::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup for (int wh = -2; wh <= 2; wh++) { for (int sect = 1; sect <= 14; sect++) { for (int st = 1; st <= 4; st++) { + if (sliceTestMode && (sect != 12 || wh != 2)) { + continue; + } if ((sect == 13 || sect == 14) && st != 4) { continue; } @@ -260,15 +270,18 @@ void DTDigiTask::bookHistos(DQMStore::IBooker& ibooker, const DTSuperLayerId& dt string histoTitle = histoName + " (TDC Counts)"; if (!readTTrigDB) { - (digiHistos[histoTag])[dtSL.rawId()] = - ibooker.book1D(histoName, histoTitle, maxTTMounts / timeBoxGranularity, 0, maxTTMounts); + (digiHistos[histoTag])[dtSL.rawId()] = ibooker.book1D( + histoName, histoTitle, maxTTMounts / timeBoxGranularity, tdcPedestal, maxTTMounts + tdcPedestal); if (doLayerTimeBoxes) { // Book TimeBoxes per layer for (int layer = 1; layer != 5; ++layer) { DTLayerId layerId(dtSL, layer); stringstream layerHistoName; layerHistoName << histoName << "_L" << layer; - (digiHistos[histoTag])[layerId.rawId()] = ibooker.book1D( - layerHistoName.str(), layerHistoName.str(), maxTTMounts / timeBoxGranularity, 0, maxTTMounts); + (digiHistos[histoTag])[layerId.rawId()] = ibooker.book1D(layerHistoName.str(), + layerHistoName.str(), + maxTTMounts / timeBoxGranularity, + tdcPedestal, + maxTTMounts + tdcPedestal); } } } else { @@ -603,8 +616,7 @@ void DTDigiTask::analyze(const edm::Event& event, const edm::EventSetup& c) { } if (sliceTestMode) { - tdcTime -= tdcPedestal; - tdcTime = std::max(1, std::min(maxTTMounts - 1, tdcTime)); + tdcTime = std::max(tdcPedestal + 1, std::min(tdcPedestal + maxTTMounts - 1, tdcTime)); // std::cout << tdcTime << std::endl; } diff --git a/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.cc b/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.cc index 09e8319700885..6df470156057c 100644 --- a/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.cc +++ b/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.cc @@ -36,62 +36,68 @@ using namespace std; class DTTPGCompareUnit { public: - DTTPGCompareUnit() { theQual = -1; } + DTTPGCompareUnit() { m_qual = -1; } ~DTTPGCompareUnit(){}; void setTM(int qual, int bx) { - theQual = qual; - theBX = bx; + m_qual = qual; + m_BX = bx; } - int qualTM() const { return theQual; } + int qualTM() const { return m_qual; } private: - int theQual; - int theBX; + int m_qual; + int m_BX; }; DTLocalTriggerBaseTask::DTLocalTriggerBaseTask(const edm::ParameterSet& ps) - : nEvents(0), nLumis(0), theTrigGeomUtils(nullptr) { + : m_nEvents(0), m_nLumis(0), m_trigGeomUtils(nullptr) { LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") << "[DTLocalTriggerBaseTask]: Constructor" << endl; - tpMode = ps.getUntrackedParameter("testPulseMode"); - detailedAnalysis = ps.getUntrackedParameter("detailedAnalysis"); + m_tpMode = ps.getUntrackedParameter("testPulseMode"); + m_detailedAnalysis = ps.getUntrackedParameter("detailedAnalysis"); - targetBXTM = ps.getUntrackedParameter("targetBXTM"); - bestAccRange = ps.getUntrackedParameter("bestTrigAccRange"); + m_targetBXTM = ps.getUntrackedParameter("targetBXTM"); + m_bestAccRange = ps.getUntrackedParameter("bestTrigAccRange"); - processTM = ps.getUntrackedParameter("processTM"); + m_processTM = ps.getUntrackedParameter("processTM"); + m_processAB7 = ps.getUntrackedParameter("processAB7"); - tm_phiIn_Token_ = consumes(ps.getUntrackedParameter("inputTagTMphIn")); - tm_phiOut_Token_ = consumes(ps.getUntrackedParameter("inputTagTMphOut")); - tm_theta_Token_ = consumes(ps.getUntrackedParameter("inputTagTMth")); + m_tm_phiIn_Token = consumes(ps.getUntrackedParameter("inputTagTMphIn")); + m_tm_phiOut_Token = consumes(ps.getUntrackedParameter("inputTagTMphOut")); + m_tm_theta_Token = consumes(ps.getUntrackedParameter("inputTagTMth")); + m_ab7_phi_Token = consumes(ps.getUntrackedParameter("inputTagAB7")); - if (processTM) - theTypes.push_back("TM"); + if (m_processTM) + m_types.push_back("TM"); - if (tpMode) { + if (m_processAB7) + m_types.push_back("AB7"); + + if (m_tpMode) { topFolder("TM") = "DT/11-LocalTriggerTP-TM/"; + topFolder("AB7") = "DT/12-LocalTriggerTP-SliceTest/"; } else { topFolder("TM") = "DT/03-LocalTrigger-TM/"; + topFolder("AB7") = "DT/04-LocalTrigger-SliceTest/"; } - theParams = ps; + m_params = ps; } DTLocalTriggerBaseTask::~DTLocalTriggerBaseTask() { LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") - << "[DTLocalTriggerBaseTask]: analyzed " << nEvents << " events" << endl; - if (theTrigGeomUtils) { - delete theTrigGeomUtils; - } + << "[DTLocalTriggerBaseTask]: analyzed " << m_nEvents << " events" << endl; + if (m_trigGeomUtils) + delete m_trigGeomUtils; } void DTLocalTriggerBaseTask::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& context) { ibooker.setCurrentFolder("DT/EventInfo/Counters"); - nEventMonitor = ibooker.bookFloat("nProcessedEventsTrigger"); + m_nEventMonitor = ibooker.bookFloat("nProcessedEventsTrigger"); for (int wh = -2; wh < 3; ++wh) { for (int stat = 1; stat < 5; ++stat) { for (int sect = 1; sect < 13; ++sect) { @@ -102,73 +108,71 @@ void DTLocalTriggerBaseTask::bookHistograms(DQMStore::IBooker& ibooker, } void DTLocalTriggerBaseTask::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) { - nEventsInLS = 0; - nLumis++; - int resetCycle = theParams.getUntrackedParameter("ResetCycle"); + m_nEventsInLS = 0; + m_nLumis++; + int resetCycle = m_params.getUntrackedParameter("ResetCycle"); LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") << "[DTLocalTriggerBaseTask]: Begin of LS transition" << endl; - if (nLumis % resetCycle == 0) { - map >::const_iterator chambIt = chamberHistos.begin(); - map >::const_iterator chambEnd = chamberHistos.end(); - for (; chambIt != chambEnd; ++chambIt) { - map::const_iterator histoIt = chambIt->second.begin(); - map::const_iterator histoEnd = chambIt->second.end(); - for (; histoIt != histoEnd; ++histoIt) { - histoIt->second->Reset(); - } - } - } + if (m_nLumis % resetCycle == 0) + for (auto& histosInChamb : m_chamberHistos) + for (auto& histo : histosInChamb.second) + histo.second->Reset(); } void DTLocalTriggerBaseTask::endLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) { LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") << "[DTLocalTriggerBaseTask]: End of LS transition" << endl; - map::const_iterator chambIt = trendHistos.begin(); - map::const_iterator chambEnd = trendHistos.end(); - for (; chambIt != chambEnd; ++chambIt) { - cout << "updating time slot in DTLocalTriggerBaseTask" << endl; - chambIt->second->updateTimeSlot(lumiSeg.luminosityBlock(), nEventsInLS); - cout << "updated time slot in DTLocalTriggerBaseTask" << endl; - } + for (auto& trendHisto : m_trendHistos) + trendHisto.second->updateTimeSlot(lumiSeg.luminosityBlock(), m_nEventsInLS); } void DTLocalTriggerBaseTask::dqmBeginRun(const edm::Run& run, const edm::EventSetup& context) { LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") << "[DTLocalTriggerBaseTask]: BeginRun" << endl; - ESHandle theGeom; - context.get().get(theGeom); - theTrigGeomUtils = new DTTrigGeomUtils(theGeom); + ESHandle geom; + context.get().get(geom); + m_trigGeomUtils = new DTTrigGeomUtils(geom); } void DTLocalTriggerBaseTask::analyze(const edm::Event& e, const edm::EventSetup& c) { - nEvents++; - nEventsInLS++; - nEventMonitor->Fill(nEvents); + m_nEvents++; + m_nEventsInLS++; + m_nEventMonitor->Fill(m_nEvents); - theCompMapIn.clear(); - theCompMapOut.clear(); + m_compMapIn.clear(); + m_compMapOut.clear(); Handle phiInTrigsTM; Handle phiOutTrigsTM; Handle thetaTrigsTM; + Handle phiTrigsAB7; - if (processTM) { - InputTag inputTagTM = theParams.getUntrackedParameter("inputTagTM"); - - e.getByToken(tm_phiIn_Token_, phiInTrigsTM); - e.getByToken(tm_phiOut_Token_, phiOutTrigsTM); - e.getByToken(tm_theta_Token_, thetaTrigsTM); + if (m_processTM) { + e.getByToken(m_tm_phiIn_Token, phiInTrigsTM); + e.getByToken(m_tm_phiOut_Token, phiOutTrigsTM); + e.getByToken(m_tm_theta_Token, thetaTrigsTM); if (phiInTrigsTM.isValid() && phiOutTrigsTM.isValid() && thetaTrigsTM.isValid()) { runTMAnalysis(phiInTrigsTM->getContainer(), phiOutTrigsTM->getContainer(), thetaTrigsTM->getContainer()); } else { LogVerbatim("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") - << "[DTLocalTriggerBaseTask]: one or more TM handles for Input Tag " << inputTagTM << " not found!" << endl; + << "[DTLocalTriggerBaseTask]: one or more TM tokens not valid!" << endl; return; } } + + if (m_processAB7) { + e.getByToken(m_ab7_phi_Token, phiTrigsAB7); + + if (phiTrigsAB7.isValid()) { + runAB7Analysis(phiTrigsAB7->getContainer()); + } else { + LogVerbatim("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") + << "[DTLocalTriggerBaseTask]: AB7 token not valid!" << endl; + } + } } void DTLocalTriggerBaseTask::bookHistos(DQMStore::IBooker& ibooker, const DTChamberId& dtCh) { @@ -184,131 +188,131 @@ void DTLocalTriggerBaseTask::bookHistos(DQMStore::IBooker& ibooker, const DTCham map minBX; map maxBX; - minBX["TM"] = theParams.getUntrackedParameter("minBXTM"); - maxBX["TM"] = theParams.getUntrackedParameter("maxBXTM"); + minBX["TM"] = m_params.getUntrackedParameter("minBXTM"); + maxBX["TM"] = m_params.getUntrackedParameter("maxBXTM"); + minBX["AB7"] = m_params.getUntrackedParameter("minBXAB7"); + maxBX["AB7"] = m_params.getUntrackedParameter("maxBXAB7"); string chTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); string labelInOut = ""; - vector::const_iterator typeIt = theTypes.begin(); - vector::const_iterator typeEnd = theTypes.end(); - - for (; typeIt != typeEnd; ++typeIt) { + for (const auto& type : m_types) { LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") - << "[DTLocalTriggerBaseTask]: booking histos for " << topFolder((*typeIt)) << "Wheel" << wheel.str() - << "/Sector" << sector.str() << "/Station" << station.str() << endl; + << "[DTLocalTriggerBaseTask]: booking histos for " << topFolder(type) << "Wheel" << wheel.str() << "/Sector" + << sector.str() << "/Station" << station.str() << endl; + + if (type == "AB7" && (dtCh.wheel() != 2 || dtCh.sector() != 12)) + continue; + + vector plotLabels; + vector folderLabels; - for (int InOut = 0; InOut < 2; InOut++) { + if (type == "TM") { + plotLabels.push_back("_In"); + plotLabels.push_back("_Out"); + folderLabels.push_back("/LocalTriggerPhiIn"); + folderLabels.push_back("/LocalTriggerPhiOut"); + } + if (type == "AB7") { + plotLabels.push_back(""); + folderLabels.push_back("/LocalTriggerPhi"); + } + + for (size_t iLabel = 0; iLabel < plotLabels.size(); ++iLabel) { // Book Phi View Related Plots - if (InOut == 0) { - ibooker.setCurrentFolder(topFolder(*typeIt) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + - station.str() + "/LocalTriggerPhiIn"); - labelInOut = "_In"; - } else if (InOut == 1) { - ibooker.setCurrentFolder(topFolder(*typeIt) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + - station.str() + "/LocalTriggerPhiOut"); - labelInOut = "_Out"; - } + auto plotLabel = plotLabels.at(iLabel); + ibooker.setCurrentFolder(topFolder(type) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + + station.str() + folderLabels.at(iLabel)); - string histoTag = (*typeIt) + "_BXvsQual" + labelInOut; - chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, - "BX vs trigger quality", - 7, - -0.5, - 6.5, - (int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1), - minBX[*typeIt] - .5, - maxBX[*typeIt] + .5); - setQLabels((chamberHistos[rawId])[histoTag], 1); - - if (!tpMode) { - histoTag = (*typeIt) + "_BestQual" + labelInOut; - chamberHistos[rawId][histoTag] = + int nQualities = type == "AB7" ? 11 : 7; + + string histoTag = type + "_BXvsQual" + plotLabel; + m_chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, + "BX vs trigger quality", + nQualities, + -0.5, + nQualities - 0.5, + (int)(maxBX[type] - minBX[type] + 1), + minBX[type] - .5, + maxBX[type] + .5); + if (type == "AB7") + setQLabelsPh2((m_chamberHistos[rawId])[histoTag], 1); + else + setQLabels((m_chamberHistos[rawId])[histoTag], 1); + + if (!m_tpMode && !(type == "AB7")) { + histoTag = type + "_BestQual" + plotLabel; + m_chamberHistos[rawId][histoTag] = ibooker.book1D(histoTag + chTag, "Trigger quality of best primitives", 7, -0.5, 6.5); - setQLabels(chamberHistos[rawId][histoTag], 1); + setQLabels(m_chamberHistos[rawId][histoTag], 1); - histoTag = (*typeIt) + "_Flag1stvsQual" + labelInOut; - chamberHistos[dtCh.rawId()][histoTag] = + histoTag = type + "_Flag1stvsQual" + plotLabel; + m_chamberHistos[dtCh.rawId()][histoTag] = ibooker.book2D(histoTag + chTag, "1st/2nd trig flag vs quality", 7, -0.5, 6.5, 2, -0.5, 1.5); - setQLabels(chamberHistos[rawId][histoTag], 1); + setQLabels(m_chamberHistos[rawId][histoTag], 1); - histoTag = (*typeIt) + "_FlagUpDownvsQual" + labelInOut; - chamberHistos[dtCh.rawId()][histoTag] = + histoTag = type + "_FlagUpDownvsQual" + plotLabel; + m_chamberHistos[dtCh.rawId()][histoTag] = ibooker.book2D(histoTag + chTag, "Up/Down trig flag vs quality", 7, -0.5, 6.5, 2, -0.5, 1.5); - setQLabels(chamberHistos[rawId][histoTag], 1); + setQLabels(m_chamberHistos[rawId][histoTag], 1); } - if (*typeIt == "TM") { + if (type == "TM") { float minPh, maxPh; int nBinsPh; - theTrigGeomUtils->phiRange(dtCh, minPh, maxPh, nBinsPh); + m_trigGeomUtils->phiRange(dtCh, minPh, maxPh, nBinsPh); - histoTag = (*typeIt) + "_QualvsPhirad" + labelInOut; - chamberHistos[rawId][histoTag] = + histoTag = type + "_QualvsPhirad" + plotLabel; + m_chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, "Trigger quality vs local position", nBinsPh, minPh, maxPh, 7, -0.5, 6.5); - setQLabels(chamberHistos[rawId][histoTag], 2); + setQLabels(m_chamberHistos[rawId][histoTag], 2); - if (detailedAnalysis && !tpMode) { - histoTag = (*typeIt) + "_QualvsPhibend" + labelInOut; - chamberHistos[rawId][histoTag] = + if (plotLabel == "_Out" && !m_tpMode) { + histoTag = type + "_RPCBitvsQual" + plotLabel; + m_chamberHistos[rawId][histoTag] = + ibooker.book2D(histoTag + chTag, "RPC bit vs DT trigger quality", 9, -1.5, 7.5, 3, -0.5, 2.5); + //setQLabels((m_chamberHistos[dtCh.rawId()])[histoTag], 2); + } + + if (m_detailedAnalysis && !m_tpMode) { + histoTag = type + "_QualvsPhibend" + plotLabel; + m_chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, "Trigger quality vs local direction", 200, -40., 40., 7, -0.5, 6.5); - setQLabels((chamberHistos[dtCh.rawId()])[histoTag], 2); + setQLabels((m_chamberHistos[dtCh.rawId()])[histoTag], 2); } } - } //InOut loop + } // Book Theta View Related Plots - ibooker.setCurrentFolder(topFolder(*typeIt) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + + ibooker.setCurrentFolder(topFolder(type) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta"); string histoTag = ""; - if ((*typeIt) == "TM" && dtCh.station() != 4) { - histoTag = (*typeIt) + "_PositionvsBX"; - chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, - "Theta trigger position vs BX", - (int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1), - minBX[*typeIt] - .5, - maxBX[*typeIt] + .5, - 7, - -0.5, - 6.5); - histoTag = (*typeIt) + "_PositionvsQual"; - chamberHistos[rawId][histoTag] = - ibooker.book2D(histoTag + chTag, "Theta trigger position vs quality", 2, 0.5, 2.5, 7, -0.5, 6.5); - setQLabelsTheta(chamberHistos[rawId][histoTag], 1); - histoTag = (*typeIt) + "_ThetaBXvsQual"; - chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, - "BX vs trigger quality", - 2, - 0.5, - 2.5, - (int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1), - minBX[*typeIt] - .5, - maxBX[*typeIt] + .5); - setQLabelsTheta(chamberHistos[rawId][histoTag], 1); - // histoTag = (*typeIt) + "_ThetaBestQual"; - // chamberHistos[rawId][histoTag] = ibooker.book1D(histoTag+chTag, - // "Trigger quality of best primitives (theta)",2,0.5,2.5); // 0 = not fired, 1 = L, 2 = H - // setQLabelsTheta(chamberHistos[rawId][histoTag],1); - } else { - if (dtCh.station() != 4) { - histoTag = (*typeIt) + "_ThetaBXvsQual"; - chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, - "BX vs trigger quality", + if (type == "TM" && dtCh.station() != 4) { + histoTag = type + "_PositionvsBX"; + m_chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, + "Theta trigger position vs BX", + (int)(maxBX[type] - minBX[type] + 1), + minBX[type] - .5, + maxBX[type] + .5, 7, -0.5, - 6.5, - (int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1), - minBX[*typeIt] - .5, - maxBX[*typeIt] + .5); - setQLabels((chamberHistos[dtCh.rawId()])[histoTag], 1); - - histoTag = (*typeIt) + "_ThetaBestQual"; - chamberHistos[rawId][histoTag] = - ibooker.book1D(histoTag + chTag, "Trigger quality of best primitives (theta)", 7, -0.5, 6.5); - setQLabels((chamberHistos[dtCh.rawId()])[histoTag], 1); - } + 6.5); + histoTag = type + "_PositionvsQual"; + m_chamberHistos[rawId][histoTag] = + ibooker.book2D(histoTag + chTag, "Theta trigger position vs quality", 3, 0.5, 3.5, 7, -0.5, 6.5); + setQLabelsTheta(m_chamberHistos[rawId][histoTag], 1); + histoTag = type + "_ThetaBXvsQual"; + m_chamberHistos[rawId][histoTag] = ibooker.book2D(histoTag + chTag, + "BX vs trigger quality", + 3, + 0.5, + 3.5, + (int)(maxBX[type] - minBX[type] + 1), + minBX[type] - .5, + maxBX[type] + .5); + setQLabelsTheta(m_chamberHistos[rawId][histoTag], 1); } } } @@ -321,7 +325,7 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* for (; iph != iphe; ++iph) { int wh = iph->whNum(); - int sec = iph->scNum() + 1; // DTTF->DT Convention + int sec = iph->scNum() + 1; // B(O)MTF->DT Convention int st = iph->stNum(); int qual = iph->code(); int is1st = iph->Ts2Tag() ? 1 : 0; @@ -334,14 +338,14 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* DTChamberId dtChId(wh, st, sec); uint32_t rawId = dtChId.rawId(); - float pos = theTrigGeomUtils->trigPos(&(*iph)); - float dir = theTrigGeomUtils->trigDir(&(*iph)); + float pos = m_trigGeomUtils->trigPos(&(*iph)); + float dir = m_trigGeomUtils->trigDir(&(*iph)); - if (abs(bx - targetBXTM) <= bestAccRange && theCompMapIn[rawId].qualTM() <= qual) - theCompMapIn[rawId].setTM(qual, bx); + if (abs(bx - m_targetBXTM) <= m_bestAccRange && m_compMapIn[rawId].qualTM() <= qual) + m_compMapIn[rawId].setTM(qual, bx); - map& innerME = chamberHistos[rawId]; - if (tpMode) { + map& innerME = m_chamberHistos[rawId]; + if (m_tpMode) { innerME["TM_BXvsQual_In"]->Fill(qual, bx); // SM BX vs Qual Phi view (1st tracks) innerME["TM_QualvsPhirad_In"]->Fill(pos, qual); // SM Qual vs radial angle Phi view } else { @@ -350,7 +354,7 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* innerME["TM_FlagUpDownvsQual_In"]->Fill(qual, updown); // SM Qual Up/Down track flag Phi view if (!is1st) innerME["TM_QualvsPhirad_In"]->Fill(pos, qual); // SM Qual vs radial angle Phi view ONLY for 1st tracks - if (detailedAnalysis) { + if (m_detailedAnalysis) { innerME["TM_QualvsPhibend_In"]->Fill(dir, qual); // SM Qual vs bending Phi view } } @@ -361,10 +365,11 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* for (; iph != iphe; ++iph) { int wh = iph->whNum(); - int sec = iph->scNum() + 1; // DTTF->DT Convention + int sec = iph->scNum() + 1; // B(O)MTF->DT Convention int st = iph->stNum(); int qual = iph->code(); int is1st = iph->Ts2Tag() ? 1 : 0; + int rpcBit = iph->RpcBit(); int bx = iph->bxNum() - is1st; int updown = iph->UpDownTag(); if (qual < 0 || qual > 6) @@ -373,24 +378,25 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* DTChamberId dtChId(wh, st, sec); uint32_t rawId = dtChId.rawId(); - float pos = theTrigGeomUtils->trigPos(&(*iph)); - float dir = theTrigGeomUtils->trigDir(&(*iph)); + float pos = m_trigGeomUtils->trigPos(&(*iph)); + float dir = m_trigGeomUtils->trigDir(&(*iph)); - if (abs(bx - targetBXTM) <= bestAccRange && theCompMapOut[rawId].qualTM() <= qual) - theCompMapOut[rawId].setTM(qual, bx); + if (abs(bx - m_targetBXTM) <= m_bestAccRange && m_compMapOut[rawId].qualTM() <= qual) + m_compMapOut[rawId].setTM(qual, bx); - map& innerME = chamberHistos[rawId]; - if (tpMode) { + map& innerME = m_chamberHistos[rawId]; + if (m_tpMode) { innerME["TM_BXvsQual_Out"]->Fill(qual, bx); // SM BX vs Qual Phi view (1st tracks) innerME["TM_QualvsPhirad_Out"]->Fill(pos, qual); // SM Qual vs radial angle Phi view } else { innerME["TM_BXvsQual_Out"]->Fill(qual, bx); // SM BX vs Qual Phi view (1st tracks) + innerME["TM_RPCBitvsQual_Out"]->Fill(qual, rpcBit); // SM RPC bitvs Qual Phi view innerME["TM_Flag1stvsQual_Out"]->Fill(qual, is1st); // SM Qual 1st/2nd track flag Phi view innerME["TM_FlagUpDownvsQual_Out"]->Fill(qual, updown); // SM Qual Up/Down track flag Phi view if (!is1st) innerME["TM_QualvsPhirad_Out"]->Fill(pos, qual); // SM Qual vs radial angle Phi view ONLY for 1st tracks - if (detailedAnalysis) { + if (m_detailedAnalysis) { innerME["TM_QualvsPhibend_Out"]->Fill(dir, qual); // SM Qual vs bending Phi view } } @@ -401,19 +407,22 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* for (; ith != ithe; ++ith) { int wh = ith->whNum(); - int sec = ith->scNum() + 1; // DTTF -> DT Convention + int sec = ith->scNum() + 1; // B(O)MTF -> DT Convention int st = ith->stNum(); int bx = ith->bxNum(); int thcode[7]; - for (int pos = 0; pos < 7; pos++) + for (int pos = 0; pos < 7; pos++) { thcode[pos] = ith->code(pos); + if (ith->position(pos) == 0 && ith->quality(pos) == 1) + thcode[pos] = 3; + } DTChamberId dtChId(wh, st, sec); uint32_t rawId = dtChId.rawId(); - map& innerME = chamberHistos[rawId]; + map& innerME = m_chamberHistos[rawId]; for (int pos = 0; pos < 7; pos++) if (thcode[pos] > 0) { //Fired @@ -423,28 +432,42 @@ void DTLocalTriggerBaseTask::runTMAnalysis(std::vector const* } } // Fill Quality plots with best TM triggers (phi view In) - if (!tpMode) { - map::const_iterator compIt = theCompMapIn.begin(); - map::const_iterator compEnd = theCompMapIn.end(); - for (; compIt != compEnd; ++compIt) { - int bestQual = compIt->second.qualTM(); + if (!m_tpMode) { + for (auto& comp : m_compMapIn) { + int bestQual = comp.second.qualTM(); if (bestQual > -1) - chamberHistos[compIt->first]["TM_BestQual_In"]->Fill(bestQual); // SM Best Qual Trigger Phi view + m_chamberHistos[comp.first]["TM_BestQual_In"]->Fill(bestQual); // SM Best Qual Trigger Phi view } } // Fill Quality plots with best TM triggers (phi view Out) - if (!tpMode) { - map::const_iterator compIt = theCompMapOut.begin(); - map::const_iterator compEnd = theCompMapOut.end(); - for (; compIt != compEnd; ++compIt) { - int bestQual = compIt->second.qualTM(); + if (!m_tpMode) { + for (auto& comp : m_compMapOut) { + int bestQual = comp.second.qualTM(); if (bestQual > -1) - chamberHistos[compIt->first]["TM_BestQual_Out"]->Fill(bestQual); // SM Best Qual Trigger Phi view + m_chamberHistos[comp.first]["TM_BestQual_Out"]->Fill(bestQual); // SM Best Qual Trigger Phi view } } } +void DTLocalTriggerBaseTask::runAB7Analysis(std::vector const* phTrigs) { + vector::const_iterator iph = phTrigs->begin(); + vector::const_iterator iphe = phTrigs->end(); + for (; iph != iphe; ++iph) { + int wh = iph->whNum(); + int sec = iph->scNum() + 1; // B(O)MTF->DT Convention + int st = iph->stNum(); + int qual = iph->quality(); + int bx = iph->bxNum(); + + DTChamberId dtChId(wh, st, sec); + uint32_t rawId = dtChId.rawId(); + + map& innerME = m_chamberHistos[rawId]; + innerME["AB7_BXvsQual"]->Fill(qual, bx); + } +} + void DTLocalTriggerBaseTask::setQLabels(MonitorElement* me, short int iaxis) { TH1* histo = me->getTH1(); if (!histo) @@ -480,12 +503,34 @@ void DTLocalTriggerBaseTask::setQLabelsTheta(MonitorElement* me, short int iaxis if (!axis) return; - string labels[2] = {"L", "H"}; + string labels[3] = {"L", "H", "err"}; + int istart = axis->GetXmin() < -1 ? 2 : 1; + for (int i = 0; i < 3; i++) { + axis->SetBinLabel(i + istart, labels[i].c_str()); + } +} + +void DTLocalTriggerBaseTask::setQLabelsPh2(MonitorElement* me, short int iaxis) { + TH1* histo = me->getTH1(); + if (!histo) + return; + + TAxis* axis = nullptr; + if (iaxis == 1) { + axis = histo->GetXaxis(); + } else if (iaxis == 2) { + axis = histo->GetYaxis(); + } + if (!axis) + return; + + string labels[11] = {"", "L only", "L multiple", "H only", "H multiple", "3+2", "LL", "4+2", "HL", "HH", ""}; int istart = axis->GetXmin() < -1 ? 2 : 1; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 11; i++) { axis->SetBinLabel(i + istart, labels[i].c_str()); } } + // Local Variables: // show-trailing-whitespace: t // truncate-lines: t diff --git a/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h b/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h index 307cc29de334b..78415c2665562 100644 --- a/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h +++ b/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h @@ -27,6 +27,7 @@ #include "DataFormats/DTDigi/interface/DTLocalTriggerCollection.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h" +#include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhContainer.h" #include #include @@ -38,6 +39,7 @@ class DTChamberId; class DTRecSegment4D; class L1MuDTChambPhDigi; class L1MuDTChambThDigi; +class L1Phase2MuDTPhDigi; class DTTPGCompareUnit; class DTTimeEvolutionHisto; @@ -70,8 +72,11 @@ class DTLocalTriggerBaseTask : public DQMOneEDAnalyzer const* phOutTrigs, std::vector const* thTrigs); + /// Run analysis on Phase2 readout for SliceTest + void runAB7Analysis(std::vector const* phTrigs); + /// Get the Top folder (different between Physics and TP and TM) - std::string& topFolder(std::string const& type) { return baseFolder[type == "TM"]; } + std::string& topFolder(std::string const& type) { return m_baseFolder[type == "TM"]; } void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; @@ -84,34 +89,36 @@ class DTLocalTriggerBaseTask : public DQMOneEDAnalyzer m_types; + + std::map m_compMapIn; + std::map m_compMapOut; + std::map > m_chamberHistos; + std::map m_trendHistos; + MonitorElement* m_nEventMonitor; - int nEvents; - int nEventsInLS; - int nLumis; - - std::string baseFolder[2]; - bool tpMode; - bool detailedAnalysis; - bool processTM; - - int targetBXTM; - int bestAccRange; - - edm::ParameterSet theParams; - DTTrigGeomUtils* theTrigGeomUtils; - std::vector theTypes; - - std::map theCompMapIn; - std::map theCompMapOut; - std::map > wheelHistos; - std::map > chamberHistos; - std::map trendHistos; - MonitorElement* nEventMonitor; - - edm::EDGetTokenT tm_phiIn_Token_; - edm::EDGetTokenT tm_phiOut_Token_; - edm::EDGetTokenT tm_theta_Token_; - edm::EDGetTokenT trig_Token_; + edm::EDGetTokenT m_tm_phiIn_Token; + edm::EDGetTokenT m_tm_phiOut_Token; + edm::EDGetTokenT m_tm_theta_Token; + edm::EDGetTokenT m_ab7_phi_Token; }; #endif diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index 6822a38db92e6..316b4cf91c64d 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -314,6 +314,8 @@ #---------------------------- # Pixel tracks/vertices reco process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") +from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * +process.pixelVertices = pixelVertices.clone() process.pixelTracksTrackingRegions.RegionPSet.originRadius = 0.4 process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = 12 process.pixelTracksTrackingRegions.RegionPSet.originXPos = 0.08 diff --git a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py index f909104a39834..ba03f7f75f2d6 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -90,6 +90,8 @@ process.siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone(src = 'siPixelClustersPreSplitting') process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi") process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") +from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * +process.pixelVertices = pixelVertices.clone() process.pixelVertices.TkFilterParameters.minPt = process.pixelTracksTrackingRegions.RegionPSet.ptMin process.pixelTracksTrackingRegions.RegionPSet.originRadius = cms.double(0.4) process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = cms.double(15.) diff --git a/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py b/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py index 076cc623b25d7..13e0f3cac9b65 100644 --- a/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py @@ -9,16 +9,16 @@ alctNBin = cms.vuint32(6, 116, 20), alctMinBin = cms.vdouble(0, 0, 0), alctMaxBin = cms.vdouble(6, 116, 20), - clctVars = cms.vstring("quality", "halfstrip", "bx", + clctVars = cms.vstring("quality", "halfstrip", "pattern", "bend", "quartstrip","eightstrip"), - clctNBin = cms.vuint32(16, 240, 20, 16, 2, 2, 2), - clctMinBin = cms.vdouble(0, 0, 0, 0, 0, 0, 0), - clctMaxBin = cms.vdouble(16, 240, 20, 16, 2, 2, 2), + clctNBin = cms.vuint32(16, 240, 16, 2, 2, 2), + clctMinBin = cms.vdouble(0, 0, 0, 0, 0, 0), + clctMaxBin = cms.vdouble(16, 240, 16, 2, 2, 2), lctVars = cms.vstring( "quality", "wiregroup", "halfstrip", - "bx", "pattern", "bend", "quartstrip","eightstrip"), - lctNBin = cms.vuint32(16, 116, 240, 20, 16, 2, 2, 2), - lctMinBin = cms.vdouble(0, 0, 0, 0, 0, 0, 0, 0), - lctMaxBin = cms.vdouble(16, 116, 240, 20, 16, 2, 2, 2), + "pattern", "bend", "quartstrip","eightstrip"), + lctNBin = cms.vuint32(16, 116, 240, 16, 2, 2, 2), + lctMinBin = cms.vdouble(0, 0, 0, 0, 0, 0, 0), + lctMaxBin = cms.vdouble(16, 116, 240, 16, 2, 2, 2), ) l1tdeCSCTPG = DQMEDAnalyzer( diff --git a/DQM/L1TMonitor/src/L1TdeCSCTPG.cc b/DQM/L1TMonitor/src/L1TdeCSCTPG.cc index 2a6610b5212df..db13544a410c7 100644 --- a/DQM/L1TMonitor/src/L1TdeCSCTPG.cc +++ b/DQM/L1TMonitor/src/L1TdeCSCTPG.cc @@ -113,7 +113,6 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["clct_quality_data"]->Fill(clct->getQuality()); chamberHistos[type]["clct_halfstrip_data"]->Fill(clct->getKeyStrip()); chamberHistos[type]["clct_bend_data"]->Fill(clct->getBend()); - chamberHistos[type]["clct_bx_data"]->Fill(clct->getBX()); } } @@ -125,7 +124,6 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["clct_quality_emul"]->Fill(clct->getQuality()); chamberHistos[type]["clct_halfstrip_emul"]->Fill(clct->getKeyStrip()); chamberHistos[type]["clct_bend_emul"]->Fill(clct->getBend()); - chamberHistos[type]["clct_bx_emul"]->Fill(clct->getBX()); } } @@ -138,7 +136,6 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["lct_wiregroup_data"]->Fill(lct->getKeyWG()); chamberHistos[type]["lct_halfstrip_data"]->Fill(lct->getStrip()); chamberHistos[type]["lct_bend_data"]->Fill(lct->getBend()); - chamberHistos[type]["lct_bx_data"]->Fill(lct->getBX()); } } @@ -151,7 +148,6 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["lct_wiregroup_emul"]->Fill(lct->getKeyWG()); chamberHistos[type]["lct_halfstrip_emul"]->Fill(lct->getStrip()); chamberHistos[type]["lct_bend_emul"]->Fill(lct->getBend()); - chamberHistos[type]["lct_bx_emul"]->Fill(lct->getBX()); } } } diff --git a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc index a9dfaaeae19a9..3b20214367712 100644 --- a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc +++ b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc @@ -517,7 +517,7 @@ void SiStripMonitorCluster::createMEs(const edm::EventSetup& es, DQMStore::IBook 0, 0); if (NclusVsCycleTimeProf2D->kind() == MonitorElement::Kind::TPROFILE2D) - NclusVsCycleTimeProf2D->getTH1()->SetCanExtend(TH1::kAllAxes); + NclusVsCycleTimeProf2D->setCanExtend(TH1::kAllAxes); } if (clusterWidth_vs_amplitude_on) { ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/"); @@ -1402,7 +1402,7 @@ void SiStripMonitorCluster::createSubDetMEs(std::string label, DQMStore::IBooker ""); subdetMEs.SubDetTotClusterProf->setAxisTitle(Parameters.getParameter("xaxis"), 1); if (subdetMEs.SubDetTotClusterProf->kind() == MonitorElement::Kind::TPROFILE) - subdetMEs.SubDetTotClusterProf->getTH1()->SetCanExtend(TH1::kAllAxes); + subdetMEs.SubDetTotClusterProf->setCanExtend(TH1::kAllAxes); Parameters = conf_.getParameter("NumberOfClusterPerLayerTrendVar"); HistoName = "TotalNumberOfClusterPerLayer__" + label; @@ -1610,7 +1610,7 @@ SiStripMonitorCluster::MonitorElement* SiStripMonitorCluster::bookMETrend(const return me; me->setAxisTitle(ParametersTrend.getParameter("xaxis"), 1); if (me->kind() == MonitorElement::Kind::TPROFILE) - me->getTH1()->SetCanExtend(TH1::kAllAxes); + me->setCanExtend(TH1::kAllAxes); return me; } diff --git a/DQM/SiStripMonitorDigi/src/SiStripMonitorDigi.cc b/DQM/SiStripMonitorDigi/src/SiStripMonitorDigi.cc index 57d8ff6af31b4..67fcdfe38bb9d 100644 --- a/DQM/SiStripMonitorDigi/src/SiStripMonitorDigi.cc +++ b/DQM/SiStripMonitorDigi/src/SiStripMonitorDigi.cc @@ -452,7 +452,7 @@ void SiStripMonitorDigi::createMEs(DQMStore::IBooker& ibooker, const edm::EventS ShotsVsTimeApvShotsGlobal->setAxisTitle("Time (s)", 1); ShotsVsTimeApvShotsGlobal->setAxisTitle("# Apv Shots", 2); if (ShotsVsTimeApvShotsGlobal->kind() == MonitorElement::Kind::TPROFILE) - ShotsVsTimeApvShotsGlobal->getTH1()->SetCanExtend(TH1::kAllAxes); + ShotsVsTimeApvShotsGlobal->setCanExtend(TH1::kAllAxes); } //cumulative number of Strips in APV shots @@ -984,7 +984,7 @@ SiStripMonitorDigi::MonitorElement* SiStripMonitorDigi::bookMETrend(DQMStore::IB me->setAxisTitle("Lumisection", 1); if (me->kind() == MonitorElement::Kind::TPROFILE) - me->getTH1()->SetCanExtend(TH1::kAllAxes); + me->setCanExtend(TH1::kAllAxes); return me; } @@ -1191,7 +1191,7 @@ void SiStripMonitorDigi::createSubDetMEs(DQMStore::IBooker& ibooker, std::string subdetMEs.SubDetTotDigiProf->setAxisTitle("Lumisection", 1); if (subdetMEs.SubDetTotDigiProf->kind() == MonitorElement::Kind::TPROFILE) - subdetMEs.SubDetTotDigiProf->getTH1()->SetCanExtend(TH1::kAllAxes); + subdetMEs.SubDetTotDigiProf->setCanExtend(TH1::kAllAxes); } // Number of Digi vs Bx - Profile @@ -1305,7 +1305,7 @@ void SiStripMonitorDigi::createSubDetMEs(DQMStore::IBooker& ibooker, std::string subdetMEs.SubDetNApvShotsProf->setAxisTitle("Time (s)", 1); subdetMEs.SubDetNApvShotsProf->setAxisTitle("# Apv Shots", 2); if (subdetMEs.SubDetNApvShotsProf->kind() == MonitorElement::Kind::TPROFILE) - subdetMEs.SubDetNApvShotsProf->getTH1()->SetCanExtend(TH1::kAllAxes); + subdetMEs.SubDetNApvShotsProf->setCanExtend(TH1::kAllAxes); } SubDetMEsMap[label] = subdetMEs; diff --git a/DQM/SiStripMonitorSummary/src/SiStripApvGainsDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripApvGainsDQM.cc index 43deec401dd72..58cd68d6fe924 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripApvGainsDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripApvGainsDQM.cc @@ -73,7 +73,7 @@ void SiStripApvGainsDQM::fillSummaryMEs(const std::vector &selectedDet fPSet_.getParameter("OutputSummaryAtLayerLevelAsImage")) { TCanvas c1("c1"); selME.SummaryDistr->getTH1()->Draw(); - std::string name(selME.SummaryDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorSummary/src/SiStripBackPlaneCorrectionDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripBackPlaneCorrectionDQM.cc index 0aa04521d822c..5b6c17ac201b1 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripBackPlaneCorrectionDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripBackPlaneCorrectionDQM.cc @@ -86,7 +86,7 @@ void SiStripBackPlaneCorrectionDQM::fillSummaryMEs(const std::vector & if (fPSet_.getParameter("OutputCumulativeSummaryAtLayerLevelAsImage")) { TCanvas c2("c2"); selME.SummaryOfCumulDistr->getTH1()->Draw(); - std::string name2(selME.SummaryOfCumulDistr->getTH1()->GetTitle()); + std::string name2(selME.SummaryOfCumulDistr->getTitle()); name2 += ".png"; c2.Print(name2.c_str()); } @@ -105,7 +105,7 @@ void SiStripBackPlaneCorrectionDQM::fillSummaryMEs(const std::vector & fPSet_.getParameter("OutputCumulativeSummaryAtLayerLevelAsImage")) { TCanvas c1("c1"); selME.SummaryOfCumulDistr->getTH1()->Draw(); - std::string name(selME.SummaryOfCumulDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryOfCumulDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorSummary/src/SiStripBaseCondObjDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripBaseCondObjDQM.cc index 8ae18b14c0741..2ea4d23393adc 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripBaseCondObjDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripBaseCondObjDQM.cc @@ -1128,7 +1128,7 @@ void SiStripBaseCondObjDQM::fillSummaryMEs(const std::vector &selected fPSet_.getParameter("OutputSummaryAtLayerLevelAsImage")) { TCanvas c1("c1"); selME.SummaryDistr->getTH1()->Draw(); - std::string name(selME.SummaryDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } @@ -1137,7 +1137,7 @@ void SiStripBaseCondObjDQM::fillSummaryMEs(const std::vector &selected if (CondObj_fillId_ == "onlyCumul" || CondObj_fillId_ == "ProfileAndCumul") { TCanvas c1("c1"); selME.SummaryOfCumulDistr->getTH1()->Draw(); - std::string name(selME.SummaryOfCumulDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryOfCumulDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorSummary/src/SiStripCablingDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripCablingDQM.cc index 85dbeb23c9cc8..6d93b817e0900 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripCablingDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripCablingDQM.cc @@ -114,12 +114,12 @@ void SiStripCablingDQM::getActiveDetIds(const edm::EventSetup &eSetup) { ME->setAxisTitle("Sub Det", 1); ME->setAxisTitle("Layer", 2); - ME->getTH1()->GetXaxis()->SetBinLabel(1, "TIB"); - ME->getTH1()->GetXaxis()->SetBinLabel(2, "TID F"); - ME->getTH1()->GetXaxis()->SetBinLabel(3, "TID B"); - ME->getTH1()->GetXaxis()->SetBinLabel(4, "TOB"); - ME->getTH1()->GetXaxis()->SetBinLabel(5, "TEC F"); - ME->getTH1()->GetXaxis()->SetBinLabel(6, "TEC B"); + ME->setBinLabel(1, "TIB"); + ME->setBinLabel(2, "TID F"); + ME->setBinLabel(3, "TID B"); + ME->setBinLabel(4, "TOB"); + ME->setBinLabel(5, "TEC F"); + ME->setBinLabel(6, "TEC B"); for (int i = 0; i < 4; i++) { ME->Fill(1, i + 1, float(counterTIB[i]) / TIBDetIds[i]); @@ -145,7 +145,7 @@ void SiStripCablingDQM::getActiveDetIds(const edm::EventSetup &eSetup) { TCanvas c1("c1"); ME->getTH1()->Draw("TEXT"); ME->getTH1()->SetStats(kFALSE); - std::string name(ME->getTH1()->GetTitle()); + std::string name(ME->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorSummary/src/SiStripLorentzAngleDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripLorentzAngleDQM.cc index 95a7ddf91049b..c2e5edbac03de 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripLorentzAngleDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripLorentzAngleDQM.cc @@ -78,7 +78,7 @@ void SiStripLorentzAngleDQM::fillSummaryMEs(const std::vector &selecte if (fPSet_.getParameter("OutputCumulativeSummaryAtLayerLevelAsImage")) { TCanvas c2("c2"); selME.SummaryOfCumulDistr->getTH1()->Draw(); - std::string name2(selME.SummaryOfCumulDistr->getTH1()->GetTitle()); + std::string name2(selME.SummaryOfCumulDistr->getTitle()); name2 += ".png"; c2.Print(name2.c_str()); } @@ -97,7 +97,7 @@ void SiStripLorentzAngleDQM::fillSummaryMEs(const std::vector &selecte fPSet_.getParameter("OutputCumulativeSummaryAtLayerLevelAsImage")) { TCanvas c1("c1"); selME.SummaryOfCumulDistr->getTH1()->Draw(); - std::string name(selME.SummaryOfCumulDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryOfCumulDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorSummary/src/SiStripPedestalsDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripPedestalsDQM.cc index b33f5d8db5137..71ec55f92044c 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripPedestalsDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripPedestalsDQM.cc @@ -64,7 +64,7 @@ void SiStripPedestalsDQM::fillSummaryMEs(const std::vector &selectedDe fPSet_.getParameter("OutputSummaryAtLayerLevelAsImage")) { TCanvas c1("c1"); selME.SummaryDistr->getTH1()->Draw(); - std::string name(selME.SummaryDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorSummary/src/SiStripQualityDQM.cc b/DQM/SiStripMonitorSummary/src/SiStripQualityDQM.cc index f3cd603603d96..2685934dffbab 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripQualityDQM.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripQualityDQM.cc @@ -54,7 +54,7 @@ void SiStripQualityDQM::fillSummaryMEs(const std::vector &selectedDetI fPSet_.getParameter("OutputSummaryAtLayerLevelAsImage")) { TCanvas c1("c1"); selME.SummaryDistr->getTH1()->Draw(); - std::string name(selME.SummaryDistr->getTH1()->GetTitle()); + std::string name(selME.SummaryDistr->getTitle()); name += ".png"; c1.Print(name.c_str()); } @@ -126,7 +126,7 @@ void SiStripQualityDQM::fillMEsForLayer( if (fr > 20) { char c[9]; sprintf(c, "%d", sameLayerDetIds_[i]); - selME_.SummaryDistr->getTH1()->GetXaxis()->SetBinLabel(i + 1, c); + selME_.SummaryDistr->setBinLabel(i + 1, c); } // Fill the TkHistoMap with Quality output : @@ -325,7 +325,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int j = 0; j < 4; j++) { ME[j]->Fill(i, NBadComponent[0][i][j]); - ME[j]->getTH1()->GetXaxis()->SetBinLabel(i, binlabel.str().c_str()); + ME[j]->setBinLabel(i, binlabel.str()); } } ss << "\n"; @@ -337,7 +337,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int j = 0; j < 4; j++) { ME[j]->Fill(i + 4, NBadComponent[1][i][j]); - ME[j]->getTH1()->GetXaxis()->SetBinLabel(i + 4, binlabel.str().c_str()); + ME[j]->setBinLabel(i + 4, binlabel.str()); } } for (int i = 4; i < 7; ++i) { @@ -348,7 +348,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int j = 0; j < 4; j++) { ME[j]->Fill(i + 4, NBadComponent[1][i][j]); - ME[j]->getTH1()->GetXaxis()->SetBinLabel(i + 4, binlabel.str().c_str()); + ME[j]->setBinLabel(i + 4, binlabel.str()); } } ss << "\n"; @@ -360,7 +360,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int j = 0; j < 4; j++) { ME[j]->Fill(i + 10, NBadComponent[2][i][j]); - ME[j]->getTH1()->GetXaxis()->SetBinLabel(i + 10, binlabel.str().c_str()); + ME[j]->setBinLabel(i + 10, binlabel.str()); } } ss << "\n"; @@ -372,7 +372,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int j = 0; j < 4; j++) { ME[j]->Fill(i + 16, NBadComponent[3][i][j]); - ME[j]->getTH1()->GetXaxis()->SetBinLabel(i + 16, binlabel.str().c_str()); + ME[j]->setBinLabel(i + 16, binlabel.str()); } } for (int i = 10; i < 19; ++i) { @@ -383,7 +383,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int j = 0; j < 4; j++) { ME[j]->Fill(i + 16, NBadComponent[3][i][j]); - ME[j]->getTH1()->GetXaxis()->SetBinLabel(i + 16, binlabel.str().c_str()); + ME[j]->setBinLabel(i + 16, binlabel.str()); } } ss << "\n"; @@ -413,7 +413,7 @@ void SiStripQualityDQM::fillGrandSummaryMEs() { for (int i = 0; i < 4; i++) { TCanvas c1("c1"); ME[i]->getTH1()->Draw(); - std::string name(ME[i]->getTH1()->GetTitle()); + std::string name(ME[i]->getTitle()); name += ".png"; c1.Print(name.c_str()); } diff --git a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc index 58f465328eadd..af024708468b1 100644 --- a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc +++ b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc @@ -876,7 +876,7 @@ SiStripMonitorTrack::MonitorElement* SiStripMonitorTrack::bookMETrend(DQMStore:: 0, ""); if (me->kind() == MonitorElement::Kind::TPROFILE) - me->getTH1()->SetCanExtend(TH1::kAllAxes); + me->setCanExtend(TH1::kAllAxes); if (!me) return me; diff --git a/DQM/TrackerRemapper/plugins/BuildFile.xml b/DQM/TrackerRemapper/plugins/BuildFile.xml index 787a56559689d..f54686e67983b 100644 --- a/DQM/TrackerRemapper/plugins/BuildFile.xml +++ b/DQM/TrackerRemapper/plugins/BuildFile.xml @@ -1,14 +1,9 @@ - - - - - diff --git a/DQM/TrackingMonitor/interface/TrackAnalyzer.h b/DQM/TrackingMonitor/interface/TrackAnalyzer.h index eb4d0a11572f3..cb25867828264 100644 --- a/DQM/TrackingMonitor/interface/TrackAnalyzer.h +++ b/DQM/TrackingMonitor/interface/TrackAnalyzer.h @@ -270,10 +270,6 @@ namespace tadqm { MonitorElement* TrackEtaPhi = nullptr; MonitorElement* TrackEtaPhiInverted = nullptr; MonitorElement* TrackEtaPhiInvertedoutofphase = nullptr; - MonitorElement* TkEtaPhi_Ratio_byFoldingmap = nullptr; - MonitorElement* TkEtaPhi_Ratio_byFoldingmap_op = nullptr; - MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap = nullptr; - MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap_op = nullptr; MonitorElement* TrackEtaPhiInner = nullptr; MonitorElement* TrackEtaPhiOuter = nullptr; diff --git a/DQM/TrackingMonitor/interface/TrackEfficiencyClient.h b/DQM/TrackingMonitor/interface/TrackEfficiencyClient.h index 27b3e6651b4d9..09e083eb3d509 100644 --- a/DQM/TrackingMonitor/interface/TrackEfficiencyClient.h +++ b/DQM/TrackingMonitor/interface/TrackEfficiencyClient.h @@ -23,11 +23,7 @@ DQM class to compute the tracking efficiency #include "DQMServices/Core/interface/DQMStore.h" -#include -#include #include -#include -//#include class TrackEfficiencyClient : public DQMEDHarvester { public: diff --git a/DQM/TrackingMonitor/interface/TrackEfficiencyMonitor.h b/DQM/TrackingMonitor/interface/TrackEfficiencyMonitor.h index 5cab4d9c3d5ad..d987574454d0d 100644 --- a/DQM/TrackingMonitor/interface/TrackEfficiencyMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackEfficiencyMonitor.h @@ -14,23 +14,24 @@ Monitoring source to measure the track efficiency #include #include -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "DQMServices/Core/interface/DQMStore.h" - -#include - +#include "FWCore/Utilities/interface/EDGetToken.h" #include "RecoMuon/GlobalTrackingTools/interface/DirectTrackerNavigation.h" #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" +#include "RecoTracker/Record/interface/NavigationSchoolRecord.h" +#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "DataFormats/MuonReco/interface/MuonSelectors.h" namespace reco { class TransientTrack; @@ -107,14 +108,20 @@ class TrackEfficiencyMonitor : public DQMEDAnalyzer { MonitorElement* StandaloneMuonPtEtaPhiHighPt; const DirectTrackerNavigation* theNavigation; MuonServiceProxy* theMuonServiceProxy; + + const edm::ESGetToken ttbToken_; + const edm::ESGetToken propToken_; + const edm::ESGetToken navToken_; + const edm::ESGetToken gstToken_; + const edm::ESGetToken mfToken_; + const edm::ESGetToken mtToken_; + edm::EDGetTokenT > muonToken_; - edm::ESHandle theGeometricSearchTracker; - edm::ESHandle thePropagator; - edm::ESHandle thePropagatorCyl; - edm::ESHandle theTTrackBuilder; - edm::ESHandle theTracker; - edm::ESHandle bField; - - edm::ESHandle measurementTrackerHandle; + + const Propagator* thePropagator; + const TransientTrackBuilder* theTTrackBuilder; + const GeometricSearchTracker* theTracker; + const MagneticField* bField; + const MeasurementTracker* measurementTracker; }; #endif diff --git a/DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h b/DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h new file mode 100644 index 0000000000000..8efd5f921324a --- /dev/null +++ b/DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h @@ -0,0 +1,55 @@ +#ifndef TrackingMonitor_TrackFoldedOccupancyClient_h +#define TrackingMonitor_TrackFoldedOccupancyClient_h +// -*- C++ -*- +// +// Package: TrackingMonitor +// Class : TrackFoldedOccupancyClient +// +//DQM class to plot occupancy in eta phi + +#include + +#include "DQMServices/Core/interface/DQMEDHarvester.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "DQMServices/Core/interface/DQMStore.h" + +class TrackFoldedOccupancyClient : public DQMEDHarvester { +public: + /// Constructor + TrackFoldedOccupancyClient(const edm::ParameterSet& ps); + + /// Destructor + ~TrackFoldedOccupancyClient() override; + +protected: + /// BeginJob + void beginJob(void) override; + + /// BeginRun + void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override; + + /// EndJob + void dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) override; + +private: + /// book MEs + void bookMEs(DQMStore::IBooker& ibooker_); + + edm::ParameterSet conf_; + std::string algoName_; + std::string quality_; + std::string state_; + std::string histTag_; + std::string TopFolder_; + + MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap = nullptr; + MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap_op = nullptr; + MonitorElement* TkEtaPhi_Ratio_byFoldingmap = nullptr; + MonitorElement* TkEtaPhi_Ratio_byFoldingmap_op = nullptr; +}; +#endif diff --git a/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h b/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h index 8d05e9adc45e8..bfb9e9f735aac 100644 --- a/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h @@ -11,26 +11,27 @@ // Original Author: Nhan Tran // Created: Thu 28 22:45:30 CEST 2008 -#include #include -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" +#include +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include - -#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" - -#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "FWCore/Utilities/interface/EDGetToken.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" class TProfile; @@ -58,11 +59,17 @@ class TrackSplittingMonitor : public DQMEDAnalyzer { DQMStore* dqmStore_; edm::ParameterSet conf_; - edm::ESHandle theGeometry; - edm::ESHandle theMagField; - edm::ESHandle dtGeometry; - edm::ESHandle cscGeometry; - edm::ESHandle rpcGeometry; + const edm::ESGetToken mfToken_; + const edm::ESGetToken tkGeomToken_; + const edm::ESGetToken dtGeomToken_; + const edm::ESGetToken cscGeomToken_; + const edm::ESGetToken rpcGeomToken_; + + const TrackerGeometry* theGeometry; + const MagneticField* theMagField; + const DTGeometry* dtGeometry; + const CSCGeometry* cscGeometry; + const RPCGeometry* rpcGeometry; edm::InputTag splitTracks_; edm::InputTag splitMuons_; diff --git a/DQM/TrackingMonitor/interface/TrackingMonitor.h b/DQM/TrackingMonitor/interface/TrackingMonitor.h index e10764ec35a7a..6c001bca6f402 100644 --- a/DQM/TrackingMonitor/interface/TrackingMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackingMonitor.h @@ -74,7 +74,6 @@ class TrackingMonitor : public DQMEDAnalyzer { void analyze(const edm::Event&, const edm::EventSetup&) override; void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - // virtual void dqmBeginRun(const edm::Run&, const edm::EventSetup&); private: void doProfileX(TH2* th2, MonitorElement* me); diff --git a/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py b/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py new file mode 100644 index 0000000000000..2459646a77224 --- /dev/null +++ b/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py @@ -0,0 +1,43 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + +TrackerMapFoldedClient = DQMEDHarvester("TrackFoldedOccupancyClient", + FolderName = cms.string('Tracking/TrackParameters'), + AlgoName = cms.string('GenTk'), + TrackQuality = cms.string('generalTracks'), + MeasurementState = cms.string('ImpactPoint'), + PhiMax = cms.double(3.141592654), + PhiMin = cms.double(-3.141592654), + EtaMax = cms.double(2.5), + EtaMin = cms.double(-2.5), + Eta2DBin = cms.int32(26), + Phi2DBin = cms.int32(32), +) + +from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +phase1Pixel.toModify(TrackerMapFoldedClient, EtaMin=-3., EtaMax=3.) +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker +phase2_tracker.toModify(TrackerMapFoldedClient, EtaMin=-4.5, EtaMax=4.5) + +TrackerMapFoldedClient_highpurity_dzPV0p1=TrackerMapFoldedClient.clone( + TrackQuality=cms.string('highPurityTracks/dzPV0p1') +) + +TrackerMapFoldedClient_highpurity_pt0to1=TrackerMapFoldedClient.clone( + TrackQuality=cms.string('highPurityTracks/pt_0to1') +) + +TrackerMapFoldedClient_highpurity_pt1=TrackerMapFoldedClient.clone( + TrackQuality=cms.string('highPurityTracks/pt_1') +) + +foldedMapClientSeq=cms.Sequence(TrackerMapFoldedClient*TrackerMapFoldedClient_highpurity_dzPV0p1*TrackerMapFoldedClient_highpurity_pt0to1*TrackerMapFoldedClient_highpurity_pt1) + +#run3 +TrackerMapFoldedClient_hiConformalPixelTracks=TrackerMapFoldedClient.clone( + TrackQuality = cms.string('hiConformalPixelTracks') +) + +folded_with_conformalpixtkclient= cms.Sequence(TrackerMapFoldedClient_hiConformalPixelTracks+foldedMapClientSeq.copy()) +from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +pp_on_AA.toReplaceWith(foldedMapClientSeq, folded_with_conformalpixtkclient) diff --git a/DQM/TrackingMonitor/src/GetLumi.cc b/DQM/TrackingMonitor/src/GetLumi.cc index b8c8508f4c1c1..7b7df55f97228 100644 --- a/DQM/TrackingMonitor/src/GetLumi.cc +++ b/DQM/TrackingMonitor/src/GetLumi.cc @@ -4,7 +4,6 @@ * \author: Mia Tosi,40 3-B32,+41227671609 */ -#include #include "DQM/TrackingMonitor/interface/GetLumi.h" #include "FWCore/Framework/interface/LuminosityBlock.h" @@ -63,9 +62,9 @@ double GetLumi::getRawValue(edm::LuminosityBlock const& lumiBlock, edm::EventSet if (lumiSummary_->isValid()) { lumi = lumiSummary_->avgInsDelLumi(); intDelLumi = lumiSummary_->intgDelLumi(); - std::cout << "Luminosity in this Lumi Section " << lumi << " --> " << intDelLumi << std::endl; + edm::LogInfo("GetLumi") << "Luminosity in this Lumi Section " << lumi << " --> " << intDelLumi << std::endl; } else { - std::cout << "No valid data found!" << std::endl; + edm::LogWarning("GetLumi") << "No valid data found!" << std::endl; } return lumi; diff --git a/DQM/TrackingMonitor/src/LogMessageMonitor.cc b/DQM/TrackingMonitor/src/LogMessageMonitor.cc index 35a596b4a9b80..552c8f0dc8167 100644 --- a/DQM/TrackingMonitor/src/LogMessageMonitor.cc +++ b/DQM/TrackingMonitor/src/LogMessageMonitor.cc @@ -114,8 +114,7 @@ void LogMessageMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& lumiDetails_->getValue(iEvent); // Take the ErrorSummaryEntry container - edm::Handle > errors; - iEvent.getByToken(errorToken_, errors); + edm::Handle > errors = iEvent.getHandle(errorToken_); // Check that errors is valid if (!errors.isValid()) return; diff --git a/DQM/TrackingMonitor/src/PrimaryVertexResolution.cc b/DQM/TrackingMonitor/src/PrimaryVertexResolution.cc index 78a1796ce061e..1c9bd64817867 100644 --- a/DQM/TrackingMonitor/src/PrimaryVertexResolution.cc +++ b/DQM/TrackingMonitor/src/PrimaryVertexResolution.cc @@ -1,5 +1,4 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -60,13 +59,13 @@ class PrimaryVertexResolution : public DQMEDAnalyzer { const TransientTrackBuilder& ttBuilder, const reco::BeamSpot& beamspot); + const edm::ESGetToken ttbToken_; edm::EDGetTokenT vertexSrc_; edm::EDGetTokenT beamspotSrc_; edm::EDGetTokenT lumiScalersSrc_; edm::EDGetTokenT metaDataSrc_; const bool forceSCAL_; std::string rootFolder_; - std::string transientTrackBuilder_; AdaptiveVertexFitter fitter_; @@ -327,13 +326,13 @@ class PrimaryVertexResolution : public DQMEDAnalyzer { }; PrimaryVertexResolution::PrimaryVertexResolution(const edm::ParameterSet& iConfig) - : vertexSrc_(consumes(iConfig.getUntrackedParameter("vertexSrc"))), + : ttbToken_(esConsumes(edm::ESInputTag("", iConfig.getUntrackedParameter("transientTrackBuilder")))), + vertexSrc_(consumes(iConfig.getUntrackedParameter("vertexSrc"))), beamspotSrc_(consumes(iConfig.getUntrackedParameter("beamspotSrc"))), lumiScalersSrc_(consumes(iConfig.getUntrackedParameter("lumiScalersSrc"))), metaDataSrc_(consumes(iConfig.getUntrackedParameter("metaDataSrc"))), forceSCAL_(iConfig.getUntrackedParameter("forceSCAL")), rootFolder_(iConfig.getUntrackedParameter("rootFolder")), - transientTrackBuilder_(iConfig.getUntrackedParameter("transientTrackBuilder")), binningX_(iConfig), binningY_(iConfig), hPV_(binningX_, binningY_), @@ -391,34 +390,28 @@ void PrimaryVertexResolution::bookHistograms(DQMStore::IBooker& iBooker, edm::Ru } void PrimaryVertexResolution::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::Handle hvertices; - iEvent.getByToken(vertexSrc_, hvertices); + edm::Handle hvertices = iEvent.getHandle(vertexSrc_); const reco::VertexCollection& vertices = *hvertices; if (vertices.empty()) return; - edm::Handle hbeamspot; - iEvent.getByToken(beamspotSrc_, hbeamspot); + edm::Handle hbeamspot = iEvent.getHandle(beamspotSrc_); const reco::BeamSpot& beamspot = *hbeamspot; float lumi = -1.; if (forceSCAL_) { - edm::Handle lumiScalers; - iEvent.getByToken(lumiScalersSrc_, lumiScalers); + edm::Handle lumiScalers = iEvent.getHandle(lumiScalersSrc_); if (lumiScalers.isValid() && !lumiScalers->empty()) { LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); lumi = scalit->instantLumi(); } } else { - edm::Handle metaData; - iEvent.getByToken(metaDataSrc_, metaData); + edm::Handle metaData = iEvent.getHandle(metaDataSrc_); if (metaData.isValid()) lumi = metaData->instLumi(); } - edm::ESHandle ttBuilderHandle; - iSetup.get().get(transientTrackBuilder_, ttBuilderHandle); - const TransientTrackBuilder& ttBuilder = *ttBuilderHandle; + const TransientTrackBuilder& ttBuilder = iSetup.getData(ttbToken_); // deterministic seed from the event number // should not bias the result as the event number is already diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index 89db0b299953c..18463bb1fb0ab 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -1105,8 +1105,7 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event& iEvent) { good_vertices_ = 0; - edm::Handle recoPrimaryVerticesHandle; - iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); + edm::Handle recoPrimaryVerticesHandle = iEvent.getHandle(pvToken_); if (recoPrimaryVerticesHandle.isValid()) if (!recoPrimaryVerticesHandle->empty()) for (const auto& v : *recoPrimaryVerticesHandle) @@ -1120,24 +1119,21 @@ void TrackAnalyzer::setLumi(const edm::Event& iEvent, const edm::EventSetup& iSe // as done by pixelLumi http://cmslxr.fnal.gov/source/DQM/PixelLumi/plugins/PixelLumiDQM.cc if (forceSCAL_) { - edm::Handle lumiScalers; - iEvent.getByToken(lumiscalersToken_, lumiScalers); + edm::Handle lumiScalers = iEvent.getHandle(lumiscalersToken_); if (lumiScalers.isValid() && !lumiScalers->empty()) { LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); scal_lumi_ = scalit->instantLumi(); } else scal_lumi_ = -1; } else { - edm::Handle metaData; - iEvent.getByToken(metaDataToken_, metaData); + edm::Handle metaData = iEvent.getHandle(metaDataToken_); if (metaData.isValid()) scal_lumi_ = metaData->instLumi(); else scal_lumi_ = -1; } - edm::Handle > pixelClusters; - iEvent.getByToken(pixelClustersToken_, pixelClusters); + edm::Handle > pixelClusters = iEvent.getHandle(pixelClustersToken_); if (pixelClusters.isValid()) { TrackerTopology const& tTopo = iSetup.getData(trackerTopologyToken_); @@ -1285,8 +1281,7 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe } if (doDCAPlots_ || doBSPlots_ || doSIPPlots_ || doAllPlots_) { - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(beamSpotToken_, recoBeamSpotHandle); + edm::Handle recoBeamSpotHandle = iEvent.getHandle(beamSpotToken_); const reco::BeamSpot& bs = *recoBeamSpotHandle; DistanceOfClosestApproachError->Fill(track.dxyError()); @@ -1321,8 +1316,7 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe } if (doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { - edm::Handle recoPrimaryVerticesHandle; - iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); + edm::Handle recoPrimaryVerticesHandle = iEvent.getHandle(pvToken_); if (recoPrimaryVerticesHandle.isValid() && !recoPrimaryVerticesHandle->empty()) { const reco::Vertex& pv = (*recoPrimaryVerticesHandle)[0]; @@ -1746,30 +1740,6 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #eta", 1); tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #phi", 2); - histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag; - tkmes.TkEtaPhi_Ratio_byFoldingmap = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag; - tkmes.TkEtaPhi_Ratio_byFoldingmap_op = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); - histname = "TrackQoverP_" + histTag; tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10 * TrackQBin, TrackQMin, TrackQMax); tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); @@ -2026,38 +1996,8 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco if (Folder == "Tr") { tkmes.TrackEtaPhiInverted->Fill(eta, -1 * phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, 3.141592654 + -1 * phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, -1 * phi - 3.141592654); - tkmes.TkEtaPhi_Ratio_byFoldingmap->divide(tkmes.TrackEtaPhi, tkmes.TrackEtaPhiInverted, 1., 1., ""); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->divide(tkmes.TrackEtaPhi, tkmes.TrackEtaPhiInvertedoutofphase, 1., 1., ""); - - int nx = tkmes.TrackEtaPhi->getNbinsX(); - int ny = tkmes.TrackEtaPhi->getNbinsY(); - - //NOTE: for full reproducibility when using threads, this loop needs to be - // a critical section - for (int ii = 1; ii <= nx; ii++) { - for (int jj = 1; jj <= ny; jj++) { - double Sum1 = tkmes.TrackEtaPhi->getBinContent(ii, jj) + tkmes.TrackEtaPhiInverted->getBinContent(ii, jj); - double Sum2 = - tkmes.TrackEtaPhi->getBinContent(ii, jj) + tkmes.TrackEtaPhiInvertedoutofphase->getBinContent(ii, jj); - - double Sub1 = tkmes.TrackEtaPhi->getBinContent(ii, jj) - tkmes.TrackEtaPhiInverted->getBinContent(ii, jj); - double Sub2 = - tkmes.TrackEtaPhi->getBinContent(ii, jj) - tkmes.TrackEtaPhiInvertedoutofphase->getBinContent(ii, jj); - - if (Sum1 == 0 || Sum2 == 0) { - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setBinContent(ii, jj, 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setBinContent(ii, jj, 1); - } else { - double ratio1 = Sub1 / Sum1; - double ratio2 = Sub2 / Sum2; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setBinContent(ii, jj, ratio1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setBinContent(ii, jj, ratio2); - } - } - } - + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, M_PI - phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, -(phi + M_PI)); //pT histograms to create efficiency vs pT plot, only for the most inefficient region. if (eta < 0. && phi < -1.6) { diff --git a/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc b/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc index e04403778bbf3..96fa072d0e606 100644 --- a/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc @@ -20,8 +20,6 @@ #include #include "TMath.h" -#include - TrackBuildingAnalyzer::TrackBuildingAnalyzer(const edm::ParameterSet& iConfig) : doAllPlots(iConfig.getParameter("doAllPlots")), doAllSeedPlots(iConfig.getParameter("doSeedParameterHistos")), diff --git a/DQM/TrackingMonitor/src/TrackEfficiencyClient.cc b/DQM/TrackingMonitor/src/TrackEfficiencyClient.cc index 8ce4e6df21169..952e0836a26e6 100644 --- a/DQM/TrackingMonitor/src/TrackEfficiencyClient.cc +++ b/DQM/TrackingMonitor/src/TrackEfficiencyClient.cc @@ -5,21 +5,9 @@ */ #include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "DQM/TrackingMonitor/interface/TrackEfficiencyClient.h" -#include "DQMServices/Core/interface/DQMStore.h" - -#include -#include -#include -#include -#include -#include //----------------------------------------------------------------------------------- TrackEfficiencyClient::TrackEfficiencyClient(edm::ParameterSet const& iConfig) diff --git a/DQM/TrackingMonitor/src/TrackEfficiencyMonitor.cc b/DQM/TrackingMonitor/src/TrackEfficiencyMonitor.cc index b7f0c18174043..c0189969ebece 100644 --- a/DQM/TrackingMonitor/src/TrackEfficiencyMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackEfficiencyMonitor.cc @@ -6,7 +6,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" -//#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "MagneticField/Engine/interface/MagneticField.h" @@ -18,33 +18,30 @@ #include // needed to compute the efficiency - +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/GeometrySurface/interface/BoundPlane.h" +#include "DataFormats/GeometrySurface/interface/Cylinder.h" +#include "DataFormats/GeometrySurface/interface/Plane.h" +#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h" +#include "DataFormats/Math/interface/Vector3D.h" +#include "DataFormats/MuonReco/interface/Muon.h" #include "DataFormats/TrackCandidate/interface/TrackCandidate.h" #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "TrackingTools/GeomPropagators/interface/Propagator.h" -#include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" - +#include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h" #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h" +#include "TrackingTools/GeomPropagators/interface/Propagator.h" #include "TrackingTools/GeomPropagators/interface/SmartPropagator.h" -#include "DataFormats/Math/interface/Vector3D.h" -#include "DataFormats/GeometrySurface/interface/Plane.h" -#include "DataFormats/GeometrySurface/interface/BoundPlane.h" -#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h" - -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "DataFormats/GeometrySurface/interface/Cylinder.h" - -#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" -#include - -#include "RecoTracker/Record/interface/CkfComponentsRecord.h" +#include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "RecoTracker/Record/interface/NavigationSchoolRecord.h" //----------------------------------------------------------------------------------- TrackEfficiencyMonitor::TrackEfficiencyMonitor(const edm::ParameterSet& iConfig) + : ttbToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + propToken_(esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))), + navToken_(esConsumes(edm::ESInputTag("", "CosmicNavigationSchool"))), + gstToken_(esConsumes()), + mfToken_(esConsumes()), + mtToken_(esConsumes()) //----------------------------------------------------------------------------------- { dqmStore_ = edm::Service().operator->(); @@ -276,27 +273,23 @@ void TrackEfficiencyMonitor::bookHistograms(DQMStore::IBooker& ibooker, void TrackEfficiencyMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) //----------------------------------------------------------------------------------- { - edm::Handle tkTracks; - iEvent.getByToken(theTKTracksToken_, tkTracks); - edm::Handle staTracks; - iEvent.getByToken(theSTATracksToken_, staTracks); - edm::ESHandle nav; - iSetup.get().get("CosmicNavigationSchool", nav); - iSetup.get().get(measurementTrackerHandle); + edm::Handle tkTracks = iEvent.getHandle(theTKTracksToken_); + edm::Handle staTracks = iEvent.getHandle(theSTATracksToken_); //initialize values failedToPropagate = 0; nCompatibleLayers = 0; findDetLayer = false; - iSetup.get().get("TransientTrackBuilder", theTTrackBuilder); - iSetup.get().get("SteppingHelixPropagatorAny", thePropagator); - iSetup.get().get(bField); - iSetup.get().get(theTracker); + const NavigationSchool& nav = iSetup.getData(navToken_); + measurementTracker = &iSetup.getData(mtToken_); + theTTrackBuilder = &iSetup.getData(ttbToken_); + thePropagator = &iSetup.getData(propToken_); + bField = &iSetup.getData(mfToken_); + theTracker = &iSetup.getData(gstToken_); theNavigation = new DirectTrackerNavigation(theTracker); - edm::Handle > muons; - iEvent.getByToken(muonToken_, muons); + edm::Handle > muons = iEvent.getHandle(muonToken_); if (!muons.isValid()) return; for (edm::View::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) { @@ -347,10 +340,10 @@ void TrackEfficiencyMonitor::analyze(const edm::Event& iEvent, const edm::EventS } if (isGoodMuon) - testTrackerTracks(tkTracks, staTracks, *nav.product()); + testTrackerTracks(tkTracks, staTracks, nav); } else if (staTracks->size() == 1 || staTracks->size() == 2) - testTrackerTracks(tkTracks, staTracks, *nav.product()); + testTrackerTracks(tkTracks, staTracks, nav); } if (!trackEfficiency_ && tkTracks->size() == 1) { @@ -568,7 +561,7 @@ bool TrackEfficiencyMonitor::trackerAcceptance(TrajectoryStateOnSurface theTSOS, //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection); //Propagator* theTmpPropagator = &*thePropagator; - Propagator* theTmpPropagator = &*thePropagator->clone(); + Propagator* theTmpPropagator = thePropagator->clone(); if (theTSOS.globalPosition().y() < 0) theTmpPropagator->setPropagationDirection(oppositeToMomentum); @@ -610,7 +603,7 @@ int TrackEfficiencyMonitor::compatibleLayers(const NavigationSchool& navigationS // check the number of compatible layers //--------------------------------------------------- - std::vector barrelTOBLayers = measurementTrackerHandle->geometricSearchTracker()->tobLayers(); + std::vector barrelTOBLayers = measurementTracker->geometricSearchTracker()->tobLayers(); unsigned int layers = 0; for (unsigned int k = 0; k < barrelTOBLayers.size(); k++) { @@ -618,7 +611,7 @@ int TrackEfficiencyMonitor::compatibleLayers(const NavigationSchool& navigationS //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection); - Propagator* theTmpPropagator = &*thePropagator->clone(); + Propagator* theTmpPropagator = thePropagator->clone(); theTmpPropagator->setPropagationDirection(alongMomentum); TrajectoryStateOnSurface startTSOS = theTmpPropagator->propagate(*theTSOS.freeState(), firstLay->surface()); @@ -678,7 +671,7 @@ std::pair TrackEfficiencyMonitor::fin { //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection); - Propagator* theTmpPropagator = &*thePropagator->clone(); + Propagator* theTmpPropagator = thePropagator->clone(); theTmpPropagator->setPropagationDirection(alongMomentum); std::vector::const_iterator itl; diff --git a/DQM/TrackingMonitor/src/TrackFoldedOccupancyClient.cc b/DQM/TrackingMonitor/src/TrackFoldedOccupancyClient.cc new file mode 100644 index 0000000000000..36b8298607318 --- /dev/null +++ b/DQM/TrackingMonitor/src/TrackFoldedOccupancyClient.cc @@ -0,0 +1,122 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h" +//----------------------------------------------------------------------------------- +TrackFoldedOccupancyClient::TrackFoldedOccupancyClient(edm::ParameterSet const& iConfig) +//----------------------------------------------------------------------------------- +{ + edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::Deleting TrackFoldedOccupancyClient "; + TopFolder_ = iConfig.getParameter("FolderName"); + quality_ = iConfig.getParameter("TrackQuality"); + algoName_ = iConfig.getParameter("AlgoName"); + state_ = iConfig.getParameter("MeasurementState"); + histTag_ = (state_ == "default") ? algoName_ : state_ + "_" + algoName_; + conf_ = iConfig; +} + +//----------------------------------------------------------------------------------- +TrackFoldedOccupancyClient::~TrackFoldedOccupancyClient() +//----------------------------------------------------------------------------------- +{ + edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::Deleting TrackFoldedOccupancyClient "; +} + +//----------------------------------------------------------------------------------- +void TrackFoldedOccupancyClient::beginJob(void) +//----------------------------------------------------------------------------------- +{ + edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::beginJob done"; +} + +//----------------------------------------------------------------------------------- +void TrackFoldedOccupancyClient::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) +//----------------------------------------------------------------------------------- +{ + edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient:: Begining of Run"; +} + +//----------------------------------------------------------------------------------- +void TrackFoldedOccupancyClient::bookMEs(DQMStore::IBooker& ibooker) +//----------------------------------------------------------------------------------- +{ + ibooker.setCurrentFolder(TopFolder_ + "/" + quality_ + "/GeneralProperties/"); + int Phi2DBin = conf_.getParameter("Phi2DBin"); + int Eta2DBin = conf_.getParameter("Eta2DBin"); + double EtaMin = conf_.getParameter("EtaMin"); + double EtaMax = conf_.getParameter("EtaMax"); + double PhiMin = conf_.getParameter("PhiMin"); + double PhiMax = conf_.getParameter("PhiMax"); + + // use the AlgoName and Quality Name + std::string histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag_; + TkEtaPhi_RelativeDifference_byFoldingmap = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); + TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag_; + TkEtaPhi_RelativeDifference_byFoldingmap_op = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); + TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag_; + TkEtaPhi_Ratio_byFoldingmap = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); + TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag_; + TkEtaPhi_Ratio_byFoldingmap_op = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); + TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); +} + +//----------------------------------------------------------------------------------- +void TrackFoldedOccupancyClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) +//----------------------------------------------------------------------------------- +{ + edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::endLuminosityBlock"; + + bookMEs(ibooker); + std::string inFolder = TopFolder_ + "/" + quality_ + "/GeneralProperties/"; + + std::string hname; + hname = "TrackEtaPhi_"; + MonitorElement* TrackEtaPhi = igetter.get(inFolder + hname + histTag_); + + hname = "TrackEtaPhiInverted_"; + MonitorElement* TrackEtaPhiInverted = igetter.get(inFolder + hname + histTag_); + + hname = "TrackEtaPhiInvertedoutofphase_"; + MonitorElement* TrackEtaPhiInvertedoutofphase = igetter.get(inFolder + hname + histTag_); + + TkEtaPhi_Ratio_byFoldingmap->divide(TrackEtaPhi, TrackEtaPhiInverted, 1., 1., ""); + TkEtaPhi_Ratio_byFoldingmap_op->divide(TrackEtaPhi, TrackEtaPhiInvertedoutofphase, 1., 1., ""); + + int nx = TrackEtaPhi->getNbinsX(); + int ny = TrackEtaPhi->getNbinsY(); + + for (int ii = 1; ii <= nx; ii++) { + for (int jj = 1; jj <= ny; jj++) { + double Sum1 = TrackEtaPhi->getBinContent(ii, jj) + TrackEtaPhiInverted->getBinContent(ii, jj); + double Sum2 = TrackEtaPhi->getBinContent(ii, jj) + TrackEtaPhiInvertedoutofphase->getBinContent(ii, jj); + + double Sub1 = TrackEtaPhi->getBinContent(ii, jj) - TrackEtaPhiInverted->getBinContent(ii, jj); + double Sub2 = TrackEtaPhi->getBinContent(ii, jj) - TrackEtaPhiInvertedoutofphase->getBinContent(ii, jj); + + if (Sum1 == 0 || Sum2 == 0) { + TkEtaPhi_RelativeDifference_byFoldingmap->setBinContent(ii, jj, 1); + TkEtaPhi_RelativeDifference_byFoldingmap_op->setBinContent(ii, jj, 1); + } else { + double ratio1 = Sub1 / Sum1; + double ratio2 = Sub2 / Sum2; + TkEtaPhi_RelativeDifference_byFoldingmap->setBinContent(ii, jj, ratio1); + TkEtaPhi_RelativeDifference_byFoldingmap_op->setBinContent(ii, jj, ratio2); + } + } + } +} + +DEFINE_FWK_MODULE(TrackFoldedOccupancyClient); diff --git a/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc b/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc index 683a392427a94..f2ea89ead1708 100644 --- a/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc @@ -4,33 +4,33 @@ * \author Suchandra Dutta , Giorgia Mila */ +#include "DQM/TrackingMonitor/interface/TrackSplittingMonitor.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "MagneticField/Engine/interface/MagneticField.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "DQMServices/Core/interface/DQMStore.h" -//#include "DQM/TrackingMonitor/interface/TrackAnalyzer.h" -#include "DQM/TrackingMonitor/interface/TrackSplittingMonitor.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" #include "TrackingTools/PatternTools/interface/TSCPBuilderNoMaterial.h" -#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +//#include "DQM/TrackingMonitor/interface/TrackAnalyzer.h" #include TrackSplittingMonitor::TrackSplittingMonitor(const edm::ParameterSet& iConfig) - : dqmStore_(edm::Service().operator->()), conf_(iConfig) { + : dqmStore_(edm::Service().operator->()), + conf_(iConfig), + mfToken_(esConsumes()), + tkGeomToken_(esConsumes()), + dtGeomToken_(esConsumes()), + cscGeomToken_(esConsumes()), + rpcGeomToken_(esConsumes()) { splitTracks_ = conf_.getParameter("splitTrackCollection"); splitMuons_ = conf_.getParameter("splitMuonCollection"); splitTracksToken_ = consumes >(splitTracks_); @@ -176,20 +176,19 @@ void TrackSplittingMonitor::bookHistograms(DQMStore::IBooker& ibooker, // -- Analyse // void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - iSetup.get().get(theMagField); - iSetup.get().get(theGeometry); - iSetup.get().get(dtGeometry); - iSetup.get().get(cscGeometry); - iSetup.get().get(rpcGeometry); - - edm::Handle > splitTracks; - iEvent.getByToken(splitTracksToken_, splitTracks); + theMagField = &iSetup.getData(mfToken_); + theGeometry = &iSetup.getData(tkGeomToken_); + dtGeometry = &iSetup.getData(dtGeomToken_); + cscGeometry = &iSetup.getData(cscGeomToken_); + rpcGeometry = &iSetup.getData(rpcGeomToken_); + + edm::Handle > splitTracks = iEvent.getHandle(splitTracksToken_); if (!splitTracks.isValid()) return; edm::Handle > splitMuons; if (plotMuons_) { - iEvent.getByToken(splitMuonsToken_, splitMuons); + splitMuons = iEvent.getHandle(splitMuonsToken_); } if (splitTracks->size() == 2) { diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index 51538567acb9e..e2a47c800e163 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -747,15 +747,13 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::string Folder = MEFolderName.substr(0, 2); float lumi = -1.; if (forceSCAL_) { - edm::Handle lumiScalers; - iEvent.getByToken(lumiscalersToken_, lumiScalers); + edm::Handle lumiScalers = iEvent.getHandle(lumiscalersToken_); if (lumiScalers.isValid() && !lumiScalers->empty()) { LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); lumi = scalit->instantLumi(); } } else { - edm::Handle metaData; - iEvent.getByToken(metaDataToken_, metaData); + edm::Handle metaData = iEvent.getHandle(metaDataToken_); if (metaData.isValid()) lumi = metaData->instLumi(); } @@ -772,12 +770,10 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i NumberEventsOfVsBX->Fill(bx); // get the track collection - edm::Handle > trackHandle; - iEvent.getByToken(trackToken_, trackHandle); + edm::Handle > trackHandle = iEvent.getHandle(trackToken_); int numberOfTracks_den = 0; - edm::Handle > allTrackHandle; - iEvent.getByToken(allTrackToken_, allTrackHandle); + edm::Handle > allTrackHandle = iEvent.getHandle(allTrackToken_); if (allTrackHandle.isValid()) { for (edm::View::const_iterator track = allTrackHandle->begin(); track != allTrackHandle->end(); ++track) { @@ -786,8 +782,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i } } - edm::Handle pvHandle; - iEvent.getByToken(pvSrcToken_, pvHandle); + edm::Handle pvHandle = iEvent.getHandle(pvSrcToken_); reco::Vertex const* pv0 = nullptr; if (pvHandle.isValid()) { pv0 = &pvHandle->front(); @@ -894,21 +889,18 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i MagneticField const& theMF = iSetup.getData(magneticFieldToken_); // get the candidate collection - edm::Handle theTCHandle; - iEvent.getByToken(trackCandidateToken_, theTCHandle); + edm::Handle theTCHandle = iEvent.getHandle(trackCandidateToken_); const TrackCandidateCollection& theTCCollection = *theTCHandle; if (theTCHandle.isValid()) { // get the beam spot - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); + edm::Handle recoBeamSpotHandle = iEvent.getHandle(bsSrcToken_); const reco::BeamSpot& bs = *recoBeamSpotHandle; NumberOfTrackCandidates->Fill(theTCCollection.size()); // get the seed collection - edm::Handle > seedHandle; - iEvent.getByToken(seedToken_, seedHandle); + edm::Handle > seedHandle = iEvent.getHandle(seedToken_); const edm::View& seedCollection = *seedHandle; if (seedHandle.isValid() && !seedCollection.empty()) FractionCandidatesOverSeeds->Fill(double(theTCCollection.size()) / double(seedCollection.size())); @@ -927,15 +919,13 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i std::vector mvaCollections; std::vector qualityMaskCollections; - edm::Handle > htracks; - iEvent.getByToken(mvaTrackToken_, htracks); + edm::Handle > htracks = iEvent.getHandle(mvaTrackToken_); edm::Handle hmva; edm::Handle hqual; for (const auto& tokenTpl : mvaQualityTokens_) { - iEvent.getByToken(std::get<0>(tokenTpl), hmva); - iEvent.getByToken(std::get<1>(tokenTpl), hqual); - + hmva = iEvent.getHandle(std::get<0>(tokenTpl)); + hqual = iEvent.getHandle(std::get<1>(tokenTpl)); mvaCollections.push_back(hmva.product()); qualityMaskCollections.push_back(hqual.product()); } @@ -947,8 +937,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i if (doAllSeedPlots || doSeedNumberPlot || doSeedVsClusterPlot || runTrackBuildingAnalyzerForSeed) { // get the seed collection - edm::Handle > seedHandle; - iEvent.getByToken(seedToken_, seedHandle); + edm::Handle > seedHandle = iEvent.getHandle(seedToken_); // fill the seed info if (seedHandle.isValid()) { @@ -969,8 +958,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i } if (doAllSeedPlots || runTrackBuildingAnalyzerForSeed) { - edm::Handle > stopHandle; - iEvent.getByToken(seedStopInfoToken_, stopHandle); + edm::Handle > stopHandle = iEvent.getHandle(seedStopInfoToken_); const auto& seedStopInfo = *stopHandle; if (seedStopInfo.size() == seedCollection.size()) { @@ -979,8 +967,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i MagneticField const& theMF = iSetup.getData(magneticFieldToken_); // get the beam spot - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); + edm::Handle recoBeamSpotHandle = iEvent.getHandle(bsSrcToken_); const reco::BeamSpot& bs = *recoBeamSpotHandle; TransientTrackingRecHitBuilder const& theTTRHBuilder = iSetup.getData(transientTrackingRecHitBuilderToken_); @@ -1004,15 +991,13 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i // plots for tracking regions if (doRegionPlots) { if (!regionToken_.isUninitialized()) { - edm::Handle > hregions; - iEvent.getByToken(regionToken_, hregions); + edm::Handle > hregions = iEvent.getHandle(regionToken_); const auto& regions = *hregions; NumberOfTrackingRegions->Fill(regions.size()); theTrackBuildingAnalyzer->analyze(regions); } else if (!regionLayerSetsToken_.isUninitialized()) { - edm::Handle hregions; - iEvent.getByToken(regionLayerSetsToken_, hregions); + edm::Handle hregions = iEvent.getHandle(regionLayerSetsToken_); const auto& regions = *hregions; NumberOfTrackingRegions->Fill(regions.regionsSize()); @@ -1020,8 +1005,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i } if (doRegionCandidatePlots) { - edm::Handle hcandidates; - iEvent.getByToken(regionCandidateToken_, hcandidates); + edm::Handle hcandidates = iEvent.getHandle(regionCandidateToken_); theTrackBuildingAnalyzer->analyze(*hcandidates); } } @@ -1155,10 +1139,8 @@ void TrackingMonitor::setNclus(const edm::Event& iEvent, std::vector& array int ncluster_pix = -1; int ncluster_strip = -1; - edm::Handle > strip_clusters; - iEvent.getByToken(stripClustersToken_, strip_clusters); - edm::Handle > pixel_clusters; - iEvent.getByToken(pixelClustersToken_, pixel_clusters); + edm::Handle > strip_clusters = iEvent.getHandle(stripClustersToken_); + edm::Handle > pixel_clusters = iEvent.getHandle(pixelClustersToken_); if (strip_clusters.isValid() && pixel_clusters.isValid()) { ncluster_pix = (*pixel_clusters).dataSize(); diff --git a/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc b/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc index b3083a3d613e4..7b9cfdef9bd8c 100644 --- a/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc +++ b/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc @@ -176,14 +176,13 @@ void TrackingRecoMaterialAnalyser::analyze(const edm::Event &event, const edm::E refitter_.setServices(setup); - Handle tracks; - Handle vertices; + Handle tracks = event.getHandle(tracksToken_); + Handle vertices = event.getHandle(verticesToken_); // Get the TrackerTopology const TrackerTopology *const tTopo = &setup.getData(tTopoToken_); // Get Tracks - event.getByToken(tracksToken_, tracks); if (!tracks.isValid() || tracks->empty()) { LogInfo("TrackingRecoMaterialAnalyser") << "Invalid or empty track collection" << endl; return; @@ -196,15 +195,13 @@ void TrackingRecoMaterialAnalyser::analyze(const edm::Event &event, const edm::E }; // Get BeamSpot - Handle beamSpot; - event.getByToken(beamspotToken_, beamSpot); + Handle beamSpot = event.getHandle(beamspotToken_); // Bail out if missing if (!beamSpot.isValid()) return; reco::Vertex::Point pv(beamSpot->position()); if (usePV_) { - event.getByToken(verticesToken_, vertices); if (vertices.isValid() && !vertices->empty()) { // Since we need to use eta and Z information from the tracks, in // order not to have the reco material distribution washed out due diff --git a/DQM/TrackingMonitor/src/V0Monitor.cc b/DQM/TrackingMonitor/src/V0Monitor.cc index 287ee2f92cceb..f7da7d10f7cce 100644 --- a/DQM/TrackingMonitor/src/V0Monitor.cc +++ b/DQM/TrackingMonitor/src/V0Monitor.cc @@ -237,29 +237,25 @@ void V0Monitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) float lumi = -1.; if (forceSCAL_) { - edm::Handle lumiScalers; - iEvent.getByToken(lumiscalersToken_, lumiScalers); + edm::Handle lumiScalers = iEvent.getHandle(lumiscalersToken_); if (lumiScalers.isValid() && !lumiScalers->empty()) { LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); lumi = scalit->instantLumi(); } } else { - edm::Handle metaData; - iEvent.getByToken(metaDataToken_, metaData); + edm::Handle metaData = iEvent.getHandle(metaDataToken_); if (metaData.isValid()) lumi = metaData->instLumi(); } n_vs_lumi_->Fill(lumi); - edm::Handle beamspotHandle; - iEvent.getByToken(bsToken_, beamspotHandle); + edm::Handle beamspotHandle = iEvent.getHandle(bsToken_); reco::BeamSpot const* bs = nullptr; if (beamspotHandle.isValid()) bs = &(*beamspotHandle); - edm::Handle pvHandle; - iEvent.getByToken(pvToken_, pvHandle); + edm::Handle pvHandle = iEvent.getHandle(pvToken_); reco::Vertex const* pv = nullptr; size_t nPV = 0; if (pvHandle.isValid()) { @@ -286,8 +282,7 @@ void V0Monitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) float nLS = static_cast(iEvent.id().luminosityBlock()); n_vs_LS_->Fill(nLS); - edm::Handle v0Handle; - iEvent.getByToken(v0Token_, v0Handle); + edm::Handle v0Handle = iEvent.getHandle(v0Token_); int n = (v0Handle.isValid() ? v0Handle->size() : -1); v0_N_->Fill(n); v0_N_vs_BX_->Fill(bx, n); diff --git a/DQM/TrackingMonitor/src/VertexMonitor.cc b/DQM/TrackingMonitor/src/VertexMonitor.cc index c689e525331ed..037e9c45991fe 100644 --- a/DQM/TrackingMonitor/src/VertexMonitor.cc +++ b/DQM/TrackingMonitor/src/VertexMonitor.cc @@ -90,8 +90,7 @@ void VertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe size_t totalNumPV = 0; size_t totalNumBADndofPV = 0; - edm::Handle pvHandle; - iEvent.getByToken(pvToken_, pvHandle); + edm::Handle pvHandle = iEvent.getHandle(pvToken_); if (pvHandle.isValid()) { totalNumPV = pvHandle->size(); // std::cout << "totalNumPV : " << totalNumPV << std::endl; @@ -110,8 +109,7 @@ void VertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe } size_t totalNumGoodPV = 0; - edm::Handle selpvHandle; - iEvent.getByToken(selpvToken_, selpvHandle); + edm::Handle selpvHandle = iEvent.getHandle(selpvToken_); if (selpvHandle.isValid()) totalNumGoodPV = selpvHandle->size(); else diff --git a/DQM/TrackingMonitor/src/dEdxAnalyzer.cc b/DQM/TrackingMonitor/src/dEdxAnalyzer.cc index e2067c9c71e6c..e7bfc1a7b51c7 100644 --- a/DQM/TrackingMonitor/src/dEdxAnalyzer.cc +++ b/DQM/TrackingMonitor/src/dEdxAnalyzer.cc @@ -149,14 +149,12 @@ void dEdxAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet return; if (doDeDxPlots_ || doAllPlots_) { - edm::Handle trackCollectionHandle; - iEvent.getByToken(trackToken_, trackCollectionHandle); + edm::Handle trackCollectionHandle = iEvent.getHandle(trackToken_); if (!trackCollectionHandle.isValid()) return; for (unsigned int i = 0; i < dEdxInputList_.size(); i++) { - edm::Handle dEdxObjectHandle; - iEvent.getByToken(dEdxTokenList_[i], dEdxObjectHandle); + edm::Handle dEdxObjectHandle = iEvent.getHandle(dEdxTokenList_[i]); if (!dEdxObjectHandle.isValid()) continue; const edm::ValueMap dEdxColl = *dEdxObjectHandle.product(); diff --git a/DQM/TrackingMonitor/src/dEdxHitAnalyzer.cc b/DQM/TrackingMonitor/src/dEdxHitAnalyzer.cc index 4c618dbccdfba..89baec826614a 100644 --- a/DQM/TrackingMonitor/src/dEdxHitAnalyzer.cc +++ b/DQM/TrackingMonitor/src/dEdxHitAnalyzer.cc @@ -131,14 +131,12 @@ void dEdxHitAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i return; if (doDeDxPlots_ || doAllPlots_) { - edm::Handle trackCollectionHandle; - iEvent.getByToken(trackToken_, trackCollectionHandle); + edm::Handle trackCollectionHandle = iEvent.getHandle(trackToken_); if (!trackCollectionHandle.isValid()) return; for (unsigned int i = 0; i < dEdxInputList_.size(); i++) { - edm::Handle dEdxObjectHandle; - iEvent.getByToken(dEdxTokenList_[i], dEdxObjectHandle); + edm::Handle dEdxObjectHandle = iEvent.getHandle(dEdxTokenList_[i]); if (!dEdxObjectHandle.isValid()) continue; diff --git a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py index f7f92f6cb89c3..be90120171783 100644 --- a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py +++ b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py @@ -59,6 +59,20 @@ TrackEffClient.FolderName = 'Tracking/TrackParameters/TrackEfficiency' TrackEffClient.AlgoName = 'CKFTk' +from DQM.TrackingMonitor.TrackFoldedOccupancyClient_cfi import TrackerMapFoldedClient + +TrackerMapFoldedClient_CKFTk=TrackerMapFoldedClient.clone( + AlgoName = cms.string('CKFTk'), + MeasurementState = cms.string('default'), + TrackQuality = cms.string('') +) + +TrackerMapFoldedClient_CosmicTk=TrackerMapFoldedClient.clone( + AlgoName = cms.string('CosmicTk'), + MeasurementState = cms.string('default'), + TrackQuality = cms.string('') +) + # Sequence -TrackingCosmicDQMClient = cms.Sequence(trackingQTester*trackingOfflineAnalyser*TrackEffClient) +TrackingCosmicDQMClient = cms.Sequence(trackingQTester*trackingOfflineAnalyser*TrackEffClient*TrackerMapFoldedClient_CKFTk*TrackerMapFoldedClient_CosmicTk) diff --git a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py index 93d4038db9292..7b0291c3189c2 100644 --- a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py +++ b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py @@ -89,6 +89,21 @@ TrackEffClient.FolderName = 'Tracking/TrackParameters/TrackEfficiency' TrackEffClient.AlgoName = 'CKFTk' -TrackingOfflineDQMClient = cms.Sequence(trackingQTester*trackingOfflineAnalyser*trackingEffFromHitPattern*voMonitoringClientSequence*primaryVertexResolutionClient*TrackEffClient) +from DQM.TrackingMonitor.TrackFoldedOccupancyClient_cfi import * -TrackingOfflineDQMClientZeroBias = cms.Sequence(trackingQTester*trackingOfflineAnalyser*trackingEffFromHitPatternZeroBias*voMonitoringClientSequence*primaryVertexResolutionClient*TrackEffClient) +TrackingOfflineDQMClient = cms.Sequence(trackingQTester*trackingOfflineAnalyser*trackingEffFromHitPattern*voMonitoringClientSequence*primaryVertexResolutionClient*TrackEffClient*foldedMapClientSeq) + +TrackingOfflineDQMClientZeroBias = cms.Sequence(trackingQTester*trackingOfflineAnalyser*trackingEffFromHitPatternZeroBias*voMonitoringClientSequence*primaryVertexResolutionClient*TrackEffClient*foldedMapClientSeq) + +# fastsim customs +_TrackingOfflineDQMClient_fastsim = TrackingOfflineDQMClient.copy() +_TrackingOfflineDQMClient_fastsim.remove(foldedMapClientSeq) + +_TrackingOfflineDQMClientZeroBias_fastsim = TrackingOfflineDQMClientZeroBias.copy() +_TrackingOfflineDQMClientZeroBias_fastsim.remove(foldedMapClientSeq) + +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toReplaceWith(TrackingOfflineDQMClient,_TrackingOfflineDQMClient_fastsim) + +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toReplaceWith(TrackingOfflineDQMClientZeroBias,_TrackingOfflineDQMClientZeroBias_fastsim) diff --git a/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py b/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py index 9796072bfdc39..0548381cbccc9 100644 --- a/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py +++ b/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py @@ -1,6 +1,14 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester -hiTrackingDqmClientHeavyIons = DQMEDHarvester("TrackingDQMClientHeavyIons", +hiTrackingDqmClientHI = DQMEDHarvester("TrackingDQMClientHeavyIons", FolderName = cms.string('Tracking/TrackParameters/GeneralProperties') ) + +from DQM.TrackingMonitor.TrackFoldedOccupancyClient_cfi import TrackerMapFoldedClient + +TrackerMapFoldedClient_heavyionTk=TrackerMapFoldedClient.clone( + AlgoName = cms.string('HeavyIonTk'), + TrackQuality = cms.string('') +) +hiTrackingDqmClientHeavyIons=cms.Sequence(hiTrackingDqmClientHI*TrackerMapFoldedClient_heavyionTk) diff --git a/DataFormats/CSCDigi/interface/CSCCLCTDigi.h b/DataFormats/CSCDigi/interface/CSCCLCTDigi.h index 12a4f5bf4d3f4..cc777f80d8314 100644 --- a/DataFormats/CSCDigi/interface/CSCCLCTDigi.h +++ b/DataFormats/CSCDigi/interface/CSCCLCTDigi.h @@ -18,12 +18,14 @@ class CSCCLCTDigi { public: typedef std::vector> ComparatorContainer; - enum CLCTKeyStripMasks { kEightStripMask = 0x1, kQuartStripMask = 0x1, kHalfStripMask = 0x1f }; - enum CLCTKeyStripShifts { kEightStripShift = 6, kQuartStripShift = 5, kHalfStripShift = 0 }; + enum CLCTKeyStripMasks { kEighthStripMask = 0x1, kQuartStripMask = 0x1, kHalfStripMask = 0x1f }; + enum CLCTKeyStripShifts { kEighthStripShift = 6, kQuartStripShift = 5, kHalfStripShift = 0 }; // temporary to facilitate CCLUT-EMTF/OMTF integration studies enum CLCTPatternMasks { kRun3SlopeMask = 0xf, kRun3PatternMask = 0x7, kLegacyPatternMask = 0xf }; enum CLCTPatternShifts { kRun3SlopeShift = 7, kRun3PatternShift = 4, kLegacyPatternShift = 0 }; enum class Version { Legacy = 0, Run3 }; + // for data vs emulator studies + enum CLCTBXMask { kBXDataMask = 0x3 }; /// Constructors CSCCLCTDigi(const uint16_t valid, @@ -75,7 +77,9 @@ class CSCCLCTDigi { void setSlope(const uint16_t slope); /// slope in number of half-strips/layer - float getFractionalSlope(const uint16_t slope = 4) const; + /// negative means left-bending + /// positive means right-bending + float getFractionalSlope() const; /// return striptype uint16_t getStripType() const { return striptype_; } @@ -84,8 +88,8 @@ class CSCCLCTDigi { void setStripType(const uint16_t stripType) { striptype_ = stripType; } /// return bending - /// 0: left-bending (negative delta-strip) - /// 1: right-bending (positive delta-strip) + /// 0: left-bending (negative delta-strip / delta layer) + /// 1: right-bending (positive delta-strip / delta layer) uint16_t getBend() const { return bend_; } /// set bend @@ -103,11 +107,11 @@ class CSCCLCTDigi { /// get single quart strip bit bool getQuartStrip() const; - /// set single eight strip bit - void setEightStrip(const bool eightStrip); + /// set single eighth strip bit + void setEighthStrip(const bool eighthStrip); - /// get single eight strip bit - bool getEightStrip() const; + /// get single eighth strip bit + bool getEighthStrip() const; /// return Key CFEB ID uint16_t getCFEB() const { return cfeb_; } @@ -118,6 +122,9 @@ class CSCCLCTDigi { /// return BX uint16_t getBX() const { return bx_; } + /// return 2-bit BX as in data + uint16_t getBXData() const { return bx_ & kBXDataMask; } + /// set bx void setBX(const uint16_t bx) { bx_ = bx; } @@ -128,7 +135,7 @@ class CSCCLCTDigi { /// (32 halfstrips). There are 5 cfebs. The "strip_" variable is one /// of 32 halfstrips on the keylayer of a single CFEB, so that /// Halfstrip = (cfeb*32 + strip). - /// This function can also return the quartstrip or eightstrip + /// This function can also return the quartstrip or eighthstrip /// when the comparator code has been set uint16_t getKeyStrip(const uint16_t n = 2) const; diff --git a/DataFormats/CSCDigi/interface/CSCComparatorDigi.h b/DataFormats/CSCDigi/interface/CSCComparatorDigi.h index 106404ebd2384..3d57a7022e365 100644 --- a/DataFormats/CSCDigi/interface/CSCComparatorDigi.h +++ b/DataFormats/CSCDigi/interface/CSCComparatorDigi.h @@ -1,10 +1,10 @@ -#ifndef CSCComparatorDigi_CSCComparatorDigi_h -#define CSCComparatorDigi_CSCComparatorDigi_h +#ifndef DataFormats_CSCDigi_CSCComparatorDigi_h +#define DataFormats_CSCDigi_CSCComparatorDigi_h /** \class CSCComparatorDigi * * Digi for CSC Comparators. - * + * * * \author M. Schmitt, Northwestern * @@ -28,9 +28,15 @@ class CSCComparatorDigi { /// sort by time first, then by strip bool operator<(const CSCComparatorDigi& digi) const; + /// Get the distrip number. Counts from 0. + int getDiStrip() const; + /// Get the strip number. Counts from 1. int getStrip() const { return strip_; } + /// Get the CFEB number. Counts from 0. + int getCFEB() const; + /// Get Comparator readings. Can be 0 or 1. int getComparator() const { return comparator_; } diff --git a/DataFormats/CSCDigi/interface/CSCConstants.h b/DataFormats/CSCDigi/interface/CSCConstants.h new file mode 100644 index 0000000000000..58160a61896c8 --- /dev/null +++ b/DataFormats/CSCDigi/interface/CSCConstants.h @@ -0,0 +1,133 @@ +#ifndef DataFormats_CSCDigi_CSCConstants_h +#define DataFormats_CSCDigi_CSCConstants_h + +/** + * \class CSCConstants + * + * Static interface to basic chamber constants. + */ + +class CSCConstants { +public: + enum DDU_Info { NUM_DDUS = 5 }; + + enum CFEB_Info { + // Run-1: Maximum number of cathode front-end boards + MAX_CFEBS_RUN1 = 5, + // ME1/1 cases + NUM_CFEBS_ME1A_GANGED = 1, + NUM_CFEBS_ME1A_UNGANGED = 3, + NUM_CFEBS_ME1B = 4, + NUM_CFEBS_ME11_GANGED = NUM_CFEBS_ME1A_GANGED + NUM_CFEBS_ME1B, // 5 + NUM_CFEBS_ME11_UNGANGED = NUM_CFEBS_ME1A_UNGANGED + NUM_CFEBS_ME1B, // 7 + // Run-2: Maximum number of cathode front-end boards + MAX_CFEBS_RUN2 = NUM_CFEBS_ME11_UNGANGED, // 7 + }; + + enum FPGA_Latency { CLCT_EMUL_TIME_OFFSET = 3, ALCT_EMUL_TIME_OFFSET = 6 }; + + // Numbers obtained from https://twiki.cern.ch/twiki/pub/CMS/CSCDPGGeometry/table_of_csc_properties_150730.pdf + enum WG_Info { + NUM_WIREGROUPS_ME11 = 48, + NUM_WIREGROUPS_ME12 = 64, + NUM_WIREGROUPS_ME13 = 32, + NUM_WIREGROUPS_ME21 = 112, + NUM_WIREGROUPS_ME22 = 64, + NUM_WIREGROUPS_ME31 = 96, + NUM_WIREGROUPS_ME32 = 64, + NUM_WIREGROUPS_ME41 = 96, + NUM_WIREGROUPS_ME42 = 64, + // this number should really be 112, but has always been 119 since the + // CSC trigger was developed in 2006. Probably it would not hurt to change it to 112 + MAX_NUM_WIREGROUPS = 119 + }; + + // distrips, strips, half-strips + enum Strip_Info { + // Each CFEB reads out 8 distrips... + NUM_DISTRIPS_PER_CFEB = 8, + //...16 strips... + NUM_STRIPS_PER_CFEB = 2 * NUM_DISTRIPS_PER_CFEB, + //...32 half-strips. + NUM_HALF_STRIPS_PER_CFEB = 2 * NUM_STRIPS_PER_CFEB, + // There are exactly 80 or 112 strips... + MAX_NUM_STRIPS_RUN1 = MAX_CFEBS_RUN1 * NUM_STRIPS_PER_CFEB, // 80 + MAX_NUM_STRIPS_RUN2 = MAX_CFEBS_RUN2 * NUM_STRIPS_PER_CFEB, // 112 + //...and 160 or 224 half-strips for 5 or 7 CFEBs... + MAX_NUM_HALF_STRIPS_RUN1 = MAX_CFEBS_RUN1 * NUM_HALF_STRIPS_PER_CFEB, // 160 + MAX_NUM_HALF_STRIPS_RUN2 = MAX_CFEBS_RUN2 * NUM_HALF_STRIPS_PER_CFEB, // 224 + // ...but depending on the chamber, there may or may not be strip staggering. + /* CMS-MUO-16-001: "[..] alternate layers in a CSC are staggered by half a strip width, except + in the ME1/1 chambers where the strips are narrower and the effect is small" */ + // _TRIGGER is added at the end, because these constants are only used in the trigger + MAX_NUM_HALF_STRIPS_RUN1_TRIGGER = 1 + MAX_NUM_HALF_STRIPS_RUN1, // 161 + MAX_NUM_HALF_STRIPS_RUN2_TRIGGER = 1 + MAX_NUM_HALF_STRIPS_RUN2, // 225 + // Number of strips in ME11 (special case) + NUM_STRIPS_ME1A_GANGED = NUM_CFEBS_ME1A_GANGED * NUM_STRIPS_PER_CFEB, // 16 + NUM_STRIPS_ME1A_UNGANGED = NUM_CFEBS_ME1A_UNGANGED * NUM_STRIPS_PER_CFEB, // 48 + NUM_STRIPS_ME1B = NUM_CFEBS_ME1B * NUM_STRIPS_PER_CFEB, // 64 + // Number of half-strips in ME11 (special case) + NUM_HALF_STRIPS_ME1A_GANGED = NUM_CFEBS_ME1A_GANGED * NUM_HALF_STRIPS_PER_CFEB, // 32 + NUM_HALF_STRIPS_ME1A_UNGANGED = NUM_CFEBS_ME1A_UNGANGED * NUM_HALF_STRIPS_PER_CFEB, // 96 + NUM_HALF_STRIPS_ME1B = NUM_CFEBS_ME1B * NUM_HALF_STRIPS_PER_CFEB, // 128 + // max halfstrip number in ME1/1 chambers + MAX_HALF_STRIP_ME1A_GANGED = NUM_HALF_STRIPS_ME1A_GANGED - 1, // 31 + MAX_HALF_STRIP_ME1A_UNGANGED = NUM_HALF_STRIPS_ME1A_UNGANGED - 1, // 95 + MAX_HALF_STRIP_ME1B = NUM_HALF_STRIPS_ME1B - 1, // 127 + }; + + // CSCs have 6 layers. The key (reference) layer is the third layer + enum Layer_Info { NUM_LAYERS = 6, KEY_CLCT_LAYER = 3, KEY_ALCT_LAYER = 3 }; + + // Both ALCT and CLCTs have patterns. CLCTs have a better granularity than ALCTs, thus more patterns + enum Pattern_Info { + NUM_ALCT_PATTERNS = 3, + ALCT_PATTERN_WIDTH = 5, + NUM_CLCT_PATTERNS = 11, + CLCT_PATTERN_WIDTH = 11, + // Max number of wires participating in a pattern + MAX_WIRES_IN_PATTERN = 14, + NUM_COMPARATOR_CODES = 4096 + }; + + enum Digis_Info { MAX_DIGIS_PER_ALCT = 10, MAX_DIGIS_PER_CLCT = 8 }; + + enum LCT_stubs { + // CSC local trigger considers 4-bit BX window (16 numbers) in the readout + MAX_CLCT_TBINS = 16, + MAX_ALCT_TBINS = 16, + MAX_LCT_TBINS = 16, + // Maximum allowed matching window size + MAX_MATCH_WINDOW_SIZE = 15, + // Each CLCT processor can send up to 2 CLCTs to TMB per BX + MAX_CLCTS_PER_PROCESSOR = 2, + MAX_CLCTS_READOUT = 2, + // Each ALCT processor can send up to 2 ALCTs to TMB per BX + MAX_ALCTS_PER_PROCESSOR = 2, + MAX_ALCTS_READOUT = 2, + // Each CSC can send up to 2 LCTs to the MPC per BX + MAX_LCTS_PER_CSC = 2, + // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector + MAX_LCTS_PER_MPC = 18, + // Reference BX for LCTs in simulation and firmware + LCT_CENTRAL_BX = 8, + /* + Reference BX for ALCTs in firmware. In the ALCT simulation, + and in the motherboard simulation the ALCT central BX is 8. + However, ALCT BX is shifted before they are inserted into the EDM + ROOT file to have a central BX of 3 and be consistent with the firmware. + */ + ALCT_CENTRAL_BX = 3, + /* + Reference BX for CLCTs in firmware. In the CLCT simulation, the central + CLCT BX is 7. In the motherboard simulation they are shifted to 8 (in order + to matched with ALCTs). But in the EDM ROOT file the CLCT central BX is 7 + to be consistent with the firmware. + */ + CLCT_CENTRAL_BX = 7, + // Offset between the ALCT and CLCT central BX in simulation + ALCT_CLCT_OFFSET = 1 + }; +}; + +#endif diff --git a/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h b/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h index 8f30c9d47bb4f..74d1f7a6c330e 100644 --- a/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h +++ b/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h @@ -18,12 +18,14 @@ class CSCCorrelatedLCTDigi { public: - enum LCTKeyStripMasks { kEightStripMask = 0x1, kQuartStripMask = 0x1, kHalfStripMask = 0xff }; - enum LCTKeyStripShifts { kEightStripShift = 9, kQuartStripShift = 8, kHalfStripShift = 0 }; + enum LCTKeyStripMasks { kEighthStripMask = 0x1, kQuartStripMask = 0x1, kHalfStripMask = 0xff }; + enum LCTKeyStripShifts { kEighthStripShift = 9, kQuartStripShift = 8, kHalfStripShift = 0 }; // temporary to facilitate CCLUT-EMTF/OMTF integration studies enum LCTPatternMasks { kRun3SlopeMask = 0xf, kRun3PatternMask = 0x7, kLegacyPatternMask = 0xf }; enum LCTPatternShifts { kRun3SlopeShift = 7, kRun3PatternShift = 4, kLegacyPatternShift = 0 }; enum class Version { Legacy = 0, Run3 }; + // for data vs emulator studies + enum LCTBXMask { kBXDataMask = 0x1 }; /// Constructors CSCCorrelatedLCTDigi(const uint16_t trknmb, @@ -67,11 +69,11 @@ class CSCCorrelatedLCTDigi { /// get single quart strip bit bool getQuartStrip() const; - /// set single eight strip bit - void setEightStrip(const bool eightStrip); + /// set single eighth strip bit + void setEighthStrip(const bool eighthStrip); - /// get single eight strip bit - bool getEightStrip() const; + /// get single eighth strip bit + bool getEighthStrip() const; /* Strips are numbered starting from 1 in CMSSW @@ -102,12 +104,22 @@ class CSCCorrelatedLCTDigi { /// return the slope uint16_t getSlope() const; + /// slope in number of half-strips/layer + /// negative means left-bending + /// positive means right-bending + float getFractionalSlope() const; + /// return left/right bending + /// 0: left-bending (negative delta-strip / delta layer) + /// 1: right-bending (positive delta-strip / delta layer) uint16_t getBend() const { return bend; } /// return BX uint16_t getBX() const { return bx; } + /// return 1-bit BX as in data + uint16_t getBXData() const { return bx & kBXDataMask; } + /// return CLCT pattern number (in use again Feb 2011) /// This function should not be used for Run-3 uint16_t getCLCTPattern() const; diff --git a/DataFormats/CSCDigi/interface/CSCShowerDigi.h b/DataFormats/CSCDigi/interface/CSCShowerDigi.h new file mode 100644 index 0000000000000..b07ec5c4c6a16 --- /dev/null +++ b/DataFormats/CSCDigi/interface/CSCShowerDigi.h @@ -0,0 +1,53 @@ +#ifndef DataFormats_CSCDigi_CSCShowerDigi_h +#define DataFormats_CSCDigi_CSCShowerDigi_h + +#include +#include +#include +#include + +class CSCShowerDigi { +public: + // Run-3 definitions as provided in DN-20-033 + enum Run3Shower { kInvalid = 0, kLoose = 1, kNominal = 2, kTight = 3 }; + enum BitMask { kInTimeMask = 0x2, kOutTimeMask = 0x2 }; + enum BitShift { kInTimeShift = 0, kOutTimeShift = 2 }; + + /// Constructors + CSCShowerDigi(const uint16_t inTimeBits, const uint16_t outTimeBits, const uint16_t cscID); + /// default + CSCShowerDigi(); + + /// clear this Shower + void clear() { bits_ = 0; } + + /// data + bool isValid() const; + + bool isLooseInTime() const; + bool isNominalInTime() const; + bool isTightInTime() const; + bool isLooseOutTime() const; + bool isNominalOutTime() const; + bool isTightOutTime() const; + + uint16_t bits() const { return bits_; } + uint16_t bitsInTime() const; + uint16_t bitsOutTime() const; + + uint16_t getCSCID() const { return cscID_; } + + /// set cscID + void setCSCID(const uint16_t c) { cscID_ = c; } + +private: + void setDataWord(const uint16_t newWord, uint16_t& word, const unsigned shift, const unsigned mask); + uint16_t getDataWord(const uint16_t word, const unsigned shift, const unsigned mask) const; + + uint16_t bits_; + // 4-bit CSC chamber identifier + uint16_t cscID_; +}; + +std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi); +#endif diff --git a/DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h b/DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h new file mode 100644 index 0000000000000..f44152f1116d5 --- /dev/null +++ b/DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h @@ -0,0 +1,10 @@ +#ifndef DataFormats_CSCDigi_CSCShowerDigiCollection_h +#define DataFormats_CSCDigi_CSCShowerDigiCollection_h + +#include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" +#include "DataFormats/MuonData/interface/MuonDigiCollection.h" + +typedef MuonDigiCollection CSCShowerDigiCollection; + +#endif diff --git a/DataFormats/CSCDigi/interface/CSCStripDigi.h b/DataFormats/CSCDigi/interface/CSCStripDigi.h index ac1b617441cce..525e556b9a698 100644 --- a/DataFormats/CSCDigi/interface/CSCStripDigi.h +++ b/DataFormats/CSCDigi/interface/CSCStripDigi.h @@ -1,5 +1,5 @@ -#ifndef CSCStripDigi_CSCStripDigi_h -#define CSCStripDigi_CSCStripDigi_h +#ifndef DataFormats_CSCDigi_CSCStripDigi_h +#define DataFormats_CSCDigi_CSCStripDigi_h /** \class CSCStripDigi * @@ -40,6 +40,9 @@ class CSCStripDigi { // Get the strip number. counts from 1. int getStrip() const { return strip; } + /// Get the CFEB number. Counts from 0. + int getCFEB() const; + /// Get ADC readings std::vector const& getADCCounts() const { return ADCCounts; } diff --git a/DataFormats/CSCDigi/src/CSCCLCTDigi.cc b/DataFormats/CSCDigi/src/CSCCLCTDigi.cc index a63007f938ed7..6861d0ec056f3 100644 --- a/DataFormats/CSCDigi/src/CSCCLCTDigi.cc +++ b/DataFormats/CSCDigi/src/CSCCLCTDigi.cc @@ -116,14 +116,12 @@ void CSCCLCTDigi::setSlope(const uint16_t slope) { } // slope in number of half-strips/layer -float CSCCLCTDigi::getFractionalSlope(const uint16_t nBits) const { +float CSCCLCTDigi::getFractionalSlope() const { if (isRun3()) { - const float minSlope = 0; - const float maxSlope = 2.5; - const int range = pow(2, nBits); - const float deltaSlope = (maxSlope - minSlope) / range; - const float slopeValue = minSlope + deltaSlope * getSlope(); - return (2 * getBend() - 1) * slopeValue; + // 4-bit slope + float slope[17] = { + 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; + return (2 * getBend() - 1) * slope[getSlope()]; } else { int slope[11] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; return float(slope[getPattern()] / 5.); @@ -133,7 +131,7 @@ float CSCCLCTDigi::getFractionalSlope(const uint16_t nBits) const { uint16_t CSCCLCTDigi::getKeyStrip(const uint16_t n) const { // 10-bit case for strip data word if (compCode_ != -1 and n == 8) { - return getKeyStrip(4) * 2 + getEightStrip(); + return getKeyStrip(4) * 2 + getEighthStrip(); } // 9-bit case for strip data word else if (compCode_ != -1 and n == 4) { @@ -164,10 +162,10 @@ bool CSCCLCTDigi::getQuartStrip() const { return getDataWord(strip_, kQuartStripShift, kQuartStripMask); } -bool CSCCLCTDigi::getEightStrip() const { +bool CSCCLCTDigi::getEighthStrip() const { if (!isRun3()) return false; - return getDataWord(strip_, kEightStripShift, kEightStripMask); + return getDataWord(strip_, kEighthStripShift, kEighthStripMask); } void CSCCLCTDigi::setQuartStrip(const bool quartStrip) { @@ -176,10 +174,10 @@ void CSCCLCTDigi::setQuartStrip(const bool quartStrip) { setDataWord(quartStrip, strip_, kQuartStripShift, kQuartStripMask); } -void CSCCLCTDigi::setEightStrip(const bool eightStrip) { +void CSCCLCTDigi::setEighthStrip(const bool eighthStrip) { if (!isRun3()) return; - setDataWord(eightStrip, strip_, kEightStripShift, kEightStripMask); + setDataWord(eighthStrip, strip_, kEighthStripShift, kEighthStripMask); } void CSCCLCTDigi::setRun3(const bool isRun3) { version_ = isRun3 ? Version::Run3 : Version::Legacy; } diff --git a/DataFormats/CSCDigi/src/CSCComparatorDigi.cc b/DataFormats/CSCDigi/src/CSCComparatorDigi.cc index 6fba526c4915e..6c9267d630381 100644 --- a/DataFormats/CSCDigi/src/CSCComparatorDigi.cc +++ b/DataFormats/CSCDigi/src/CSCComparatorDigi.cc @@ -4,6 +4,7 @@ * \author M.Schmitt, Northwestern */ #include "DataFormats/CSCDigi/interface/CSCComparatorDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -61,6 +62,14 @@ int CSCComparatorDigi::getTimeBin() const { return tbin; } +/// Get the distrip number. Counts from 0. +// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +int CSCComparatorDigi::getDiStrip() const { return ((strip_ - 1) % CSCConstants::NUM_STRIPS_PER_CFEB) / 2; } + +/// Get the CFEB number. Counts from 0. +// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +int CSCComparatorDigi::getCFEB() const { return (strip_ - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } + // This definition is consistent with the one used in // the function CSCComparatorData::add() in EventFilter/CSCRawToDigi // The halfstrip counts from 0! diff --git a/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc b/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc index 88e8266b97784..e0cd1a8810f04 100644 --- a/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc +++ b/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc @@ -72,7 +72,7 @@ void CSCCorrelatedLCTDigi::clear() { uint16_t CSCCorrelatedLCTDigi::getStrip(const uint16_t n) const { // all 10 bits if (n == 8) { - return 2 * getStrip(4) + getEightStrip(); + return 2 * getStrip(4) + getEighthStrip(); } // lowest 9 bits else if (n == 4) { @@ -90,10 +90,10 @@ void CSCCorrelatedLCTDigi::setQuartStrip(const bool quartStrip) { setDataWord(quartStrip, strip, kQuartStripShift, kQuartStripMask); } -void CSCCorrelatedLCTDigi::setEightStrip(const bool eightStrip) { +void CSCCorrelatedLCTDigi::setEighthStrip(const bool eighthStrip) { if (!isRun3()) return; - setDataWord(eightStrip, strip, kEightStripShift, kEightStripMask); + setDataWord(eighthStrip, strip, kEighthStripShift, kEighthStripMask); } bool CSCCorrelatedLCTDigi::getQuartStrip() const { @@ -102,10 +102,10 @@ bool CSCCorrelatedLCTDigi::getQuartStrip() const { return getDataWord(strip, kQuartStripShift, kQuartStripMask); } -bool CSCCorrelatedLCTDigi::getEightStrip() const { +bool CSCCorrelatedLCTDigi::getEighthStrip() const { if (!isRun3()) return false; - return getDataWord(strip, kEightStripShift, kEightStripMask); + return getDataWord(strip, kEighthStripShift, kEighthStripMask); } uint16_t CSCCorrelatedLCTDigi::getSlope() const { @@ -120,6 +120,19 @@ void CSCCorrelatedLCTDigi::setSlope(const uint16_t slope) { setDataWord(slope, pattern, kRun3SlopeShift, kRun3SlopeMask); } +// slope in number of half-strips/layer +float CSCCorrelatedLCTDigi::getFractionalSlope() const { + if (isRun3()) { + // 4-bit slope + float slope[17] = { + 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; + return (2 * getBend() - 1) * slope[getSlope()]; + } else { + int slope[11] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; + return float(slope[getPattern()] / 5.); + } +} + /// return the fractional strip float CSCCorrelatedLCTDigi::getFractionalStrip(const uint16_t n) const { if (n == 8) { diff --git a/DataFormats/CSCDigi/src/CSCShowerDigi.cc b/DataFormats/CSCDigi/src/CSCShowerDigi.cc new file mode 100644 index 0000000000000..7a4545d219340 --- /dev/null +++ b/DataFormats/CSCDigi/src/CSCShowerDigi.cc @@ -0,0 +1,51 @@ +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include +#include + +using namespace std; + +/// Constructors +CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime, const uint16_t bitsOutTime, const uint16_t cscID) + : cscID_(cscID) { + setDataWord(bitsInTime, bits_, kInTimeShift, kInTimeMask); + setDataWord(bitsOutTime, bits_, kOutTimeShift, kOutTimeMask); +} + +/// Default +CSCShowerDigi::CSCShowerDigi() : bits_(0), cscID_(0) {} + +bool CSCShowerDigi::isValid() const { + // any loose shower is valid + return isLooseInTime() or isLooseOutTime(); +} + +bool CSCShowerDigi::isLooseInTime() const { return bitsInTime() >= kLoose; } + +bool CSCShowerDigi::isNominalInTime() const { return bitsInTime() >= kNominal; } + +bool CSCShowerDigi::isTightInTime() const { return bitsInTime() >= kTight; } + +bool CSCShowerDigi::isLooseOutTime() const { return bitsOutTime() >= kLoose; } + +bool CSCShowerDigi::isNominalOutTime() const { return bitsOutTime() >= kNominal; } + +bool CSCShowerDigi::isTightOutTime() const { return bitsOutTime() >= kTight; } + +uint16_t CSCShowerDigi::bitsInTime() const { return getDataWord(bits_, kInTimeShift, kInTimeMask); } + +uint16_t CSCShowerDigi::bitsOutTime() const { return getDataWord(bits_, kOutTimeShift, kOutTimeMask); } + +void CSCShowerDigi::setDataWord(const uint16_t newWord, uint16_t& word, const unsigned shift, const unsigned mask) { + // clear the old value + word &= ~(mask << shift); + + // set the new value + word |= newWord << shift; +} + +uint16_t CSCShowerDigi::getDataWord(const uint16_t word, const unsigned shift, const unsigned mask) const { + return (word >> shift) & mask; +} + +std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi) { return o << "CSC Shower: " << digi.bits(); } diff --git a/DataFormats/CSCDigi/src/CSCStripDigi.cc b/DataFormats/CSCDigi/src/CSCStripDigi.cc index eaa01654d1feb..66e0bd117c2bc 100644 --- a/DataFormats/CSCDigi/src/CSCStripDigi.cc +++ b/DataFormats/CSCDigi/src/CSCStripDigi.cc @@ -4,6 +4,7 @@ * \author M.Schmitt, Northwestern */ #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -19,6 +20,10 @@ bool CSCStripDigi::operator==(const CSCStripDigi& digi) const { return true; } +/// Get the CFEB number. Counts from 0. +// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +int CSCStripDigi::getCFEB() const { return (strip - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } + void CSCStripDigi::setADCCounts(const std::vector& vADCCounts) { bool badVal = false; for (int i = 0; i < (int)vADCCounts.size(); i++) { diff --git a/DataFormats/CSCDigi/src/classes.h b/DataFormats/CSCDigi/src/classes.h index 879a26bef5055..e8cf57f4aa1e3 100644 --- a/DataFormats/CSCDigi/src/classes.h +++ b/DataFormats/CSCDigi/src/classes.h @@ -31,6 +31,8 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" // dummy structs to ensure backward compatibility struct GEMCSCLCTDigi {}; diff --git a/DataFormats/CSCDigi/src/classes_def.xml b/DataFormats/CSCDigi/src/classes_def.xml index abf504d37a7e5..848aeeddd3639 100644 --- a/DataFormats/CSCDigi/src/classes_def.xml +++ b/DataFormats/CSCDigi/src/classes_def.xml @@ -37,6 +37,9 @@ + + + @@ -76,6 +79,7 @@ + @@ -95,6 +99,7 @@ + @@ -114,6 +119,7 @@ + @@ -134,6 +140,7 @@ + @@ -153,5 +160,6 @@ + diff --git a/DataFormats/ForwardDetId/interface/ETLDetId.h b/DataFormats/ForwardDetId/interface/ETLDetId.h index 327f3486d432f..bed807086922b 100644 --- a/DataFormats/ForwardDetId/interface/ETLDetId.h +++ b/DataFormats/ForwardDetId/interface/ETLDetId.h @@ -8,8 +8,8 @@ @class ETLDetId @brief Detector identifier class for the Endcap Timing Layer. - bit 15-7 : module sequential number - bit 6-5 : module type (unused so far) + bit 15-5 : module sequential number + bit 4-3 : module type (unused so far) */ class ETLDetId : public MTDDetId { @@ -20,10 +20,10 @@ class ETLDetId : public MTDDetId { static const uint32_t kETLformatV2 = 1; public: - static const uint32_t kETLmoduleOffset = 5; //7 - static const uint32_t kETLmoduleMask = 0x7FF; //0x1FF - static const uint32_t kETLmodTypeOffset = 3; //5 - static const uint32_t kETLmodTypeMask = 0x3; //0x3 + static const uint32_t kETLmoduleOffset = 5; + static const uint32_t kETLmoduleMask = 0x7FF; + static const uint32_t kETLmodTypeOffset = 3; + static const uint32_t kETLmodTypeMask = 0x3; static constexpr int kETLv1maxRing = 11; static constexpr int kETLv1maxModule = 176; diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index 28e2424a81944..ece599d1c9926 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -114,7 +114,7 @@ namespace ticl { p = *(probs++); } } - inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = 1.f; } + inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = value; } inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } inline const std::vector &vertices() const { return vertices_; } @@ -199,5 +199,7 @@ namespace ticl { // trackster ID probabilities std::array id_probabilities_; }; + + typedef std::vector TracksterCollection; } // namespace ticl #endif diff --git a/DataFormats/L1TMuon/interface/CSCConstants.h b/DataFormats/L1TMuon/interface/CSCConstants.h deleted file mode 100644 index 14d526cf3b5a6..0000000000000 --- a/DataFormats/L1TMuon/interface/CSCConstants.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef DataFormats_L1TMuon_CSCConstants_h -#define DataFormats_L1TMuon_CSCConstants_h - -/** - * \class CSCConstants - * - * Static interface to basic chamber constants. - */ -#include - -class CSCConstants { -public: - enum CFEB_Info { - //Maximum number of cathode front-end boards - MAX_CFEBS = 5, - }; - - enum FPGA_Latency { CLCT_EMUL_TIME_OFFSET = 3, ALCT_EMUL_TIME_OFFSET = 6 }; - - // Note: WIRE means actually "wiregroup" here - enum WG_and_Strip { - MAX_NUM_WIRES = 119, - MAX_WIRES_ME11 = 48, - MAX_NUM_STRIPS = 80, - MAX_NUM_STRIPS_7CFEBS = 112, - NUM_DI_STRIPS = 40 + 1, // Add 1 to allow for staggering of strips - NUM_HALF_STRIPS = 160 + 1, - NUM_HALF_STRIPS_7CFEBS = 224 + 1, - // each CFEB reads out 8 distrips, 16 strips or 32 halfstrips - NUM_DISTRIPS_PER_CFEB = 8, - NUM_STRIPS_PER_CFEB = 16, - NUM_HALF_STRIPS_PER_CFEB = 32, - // max halfstrip number in ME1/1 chambers - // All ME1A readout by 1 CFEB -> 32 -1 - MAX_HALF_STRIP_ME1A_GANGED = 31, - // All ME1A readout by 3 CFEBs -> 3*32 -1 - MAX_HALF_STRIP_ME1A_UNGANGED = 95, - // All ME1B readout by 4 CFEBs -> 4*32 -1 - MAX_HALF_STRIP_ME1B = 127, - MAX_NUM_STRIPS_ME1B = 64, - MAX_NUM_STRIPS_ME1A_GANGED = 16, - MAX_NUM_STRIPS_ME1A_UNGANGED = 48, - }; - - // CSCs have 6 layers. The key (refernce) layer is the third layer - enum Layer_Info { NUM_LAYERS = 6, KEY_CLCT_LAYER = 3, KEY_ALCT_LAYER = 3 }; - - // Both ALCT and CLCTs have patterns. CLCTs have a better granularity than ALCTs, thus more patterns - enum Pattern_Info { - NUM_ALCT_PATTERNS = 3, - ALCT_PATTERN_WIDTH = 5, - NUM_CLCT_PATTERNS = 11, - CLCT_PATTERN_WIDTH = 11, - // Max number of wires participating in a pattern - MAX_WIRES_IN_PATTERN = 14, - NUM_COMPARATOR_CODES = 4096 - }; - - enum Digis_Info { MAX_DIGIS_PER_ALCT = 10, MAX_DIGIS_PER_CLCT = 8 }; - - enum LCT_stubs { - // CSC local trigger considers 4-bit BX window (16 numbers) in the readout - MAX_CLCT_TBINS = 16, - MAX_ALCT_TBINS = 16, - MAX_LCT_TBINS = 16, - // Maximum allowed matching window size - MAX_MATCH_WINDOW_SIZE = 15, - // Each CLCT processor can send up to 2 CLCTs to TMB per BX - MAX_CLCTS_PER_PROCESSOR = 2, - MAX_CLCTS_READOUT = 2, - // Each ALCT processor can send up to 2 ALCTs to TMB per BX - MAX_ALCTS_PER_PROCESSOR = 2, - MAX_ALCTS_READOUT = 2, - // Each CSC can send up to 2 LCTs to the MPC per BX - MAX_LCTS_PER_CSC = 2, - // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector - MAX_LCTS_PER_MPC = 18, - // Reference BX for LCTs in simulation and firmware - LCT_CENTRAL_BX = 8, - // Offset between the ALCT and CLCT central BX in simulation - ALCT_CLCT_OFFSET = 1 - }; -}; - -#endif diff --git a/DataFormats/L1TMuon/src/EMTFHit.cc b/DataFormats/L1TMuon/src/EMTFHit.cc index 3f446353e70e8..85d86a54b235c 100644 --- a/DataFormats/L1TMuon/src/EMTFHit.cc +++ b/DataFormats/L1TMuon/src/EMTFHit.cc @@ -1,5 +1,5 @@ #include "DataFormats/L1TMuon/interface/EMTFHit.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" namespace l1t { diff --git a/DataFormats/Math/interface/choleskyInversion.h b/DataFormats/Math/interface/choleskyInversion.h index 2cb4105f86bae..b84e7cc80a120 100644 --- a/DataFormats/Math/interface/choleskyInversion.h +++ b/DataFormats/Math/interface/choleskyInversion.h @@ -20,13 +20,13 @@ namespace math { namespace cholesky { template - inline constexpr void invert11(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert11(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); dst(0, 0) = F(1.0) / src(0, 0); } template - inline constexpr void invert22(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert22(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0) * src(1, 0) * luc0; @@ -40,7 +40,7 @@ namespace math { } template - inline constexpr void invert33(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert33(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -64,7 +64,7 @@ namespace math { } template - inline constexpr void invert44(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert44(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -100,7 +100,7 @@ namespace math { } template - inline constexpr void invert55(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert55(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -155,7 +155,7 @@ namespace math { } template - inline __attribute__((always_inline)) constexpr void invert66(M1 const& src, M2& dst) { + inline constexpr void __attribute__((always_inline)) invert66(M1 const& src, M2& dst) { using F = decltype(src(0, 0)); auto luc0 = F(1.0) / src(0, 0); auto luc1 = src(1, 0); @@ -297,7 +297,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert22(src, dst); symmetrize22(dst); } @@ -305,7 +305,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert33(src, dst); symmetrize33(dst); } @@ -313,7 +313,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert44(src, dst); symmetrize44(dst); } @@ -321,7 +321,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert55(src, dst); symmetrize55(dst); } @@ -329,7 +329,7 @@ namespace math { template struct Inverter { - static constexpr void eval(M1 const& src, M2& dst) { + static constexpr void __attribute__((always_inline)) eval(M1 const& src, M2& dst) { invert66(src, dst); symmetrize66(dst); } @@ -337,7 +337,8 @@ namespace math { // Eigen interface template - inline constexpr void invert(Eigen::DenseBase const& src, Eigen::DenseBase& dst) { + inline constexpr void __attribute__((always_inline)) + invert(Eigen::DenseBase const& src, Eigen::DenseBase& dst) { using M1 = Eigen::DenseBase; using M2 = Eigen::DenseBase; Inverter::eval(src, dst); diff --git a/DataFormats/Math/test/CholeskyInvert_t.cpp b/DataFormats/Math/test/CholeskyInvert_t.cpp index c5dea25231988..de048e3d4455b 100644 --- a/DataFormats/Math/test/CholeskyInvert_t.cpp +++ b/DataFormats/Math/test/CholeskyInvert_t.cpp @@ -94,16 +94,23 @@ void go(bool soa) { for (int kk = 0; kk < NKK; ++kk) { delta -= (std::chrono::high_resolution_clock::now() - start); if (soa) +#ifdef USE_VECTORIZATION_PRAGMA #pragma GCC ivdep #ifdef __clang__ #pragma clang loop vectorize(enable) interleave(enable) +#endif #endif for (unsigned int i = 0; i < SIZE; ++i) { MapMX m(p + i); math::cholesky::invert(m, m); } else +#ifdef USE_VECTORIZATION_PRAGMA #pragma GCC ivdep +#ifdef __clang__ +#pragma clang loop vectorize(enable) interleave(enable) +#endif +#endif for (auto& m : mm) { math::cholesky::invert(m, m); } diff --git a/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h b/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h index 15557770655a9..46b2818177396 100644 --- a/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h +++ b/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h @@ -31,5 +31,7 @@ namespace reco { private: edm::PtrVector myclusters; }; + + typedef std::vector HGCalMultiClusterCollection; } // namespace reco #endif diff --git a/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc b/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc index 50f18ee851c10..4eb1df558b43f 100644 --- a/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc +++ b/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc @@ -2063,8 +2063,6 @@ static long load_dddefinition(Detector& det, xml_h element) { ns.addConstantNS("world_z", "450*m", "number"); ns.addConstantNS("Air", "materials:Air", "string"); ns.addConstantNS("Vacuum", "materials:Vacuum", "string"); - ns.addConstantNS("fm", "1e-12*m", "number"); - ns.addConstantNS("mum", "1e-6*m", "number"); string fname = xml::DocumentHandler::system_path(element); bool open_geometry = dddef.hasChild(DD_CMU(open_geometry)) ? dddef.child(DD_CMU(open_geometry)) : true; diff --git a/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h b/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h index 61a5e9914f06d..0a03d270e5166 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h +++ b/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h @@ -1,9 +1,8 @@ #ifndef EventFilter_CSCRawToDigi_CSCAnodeData_h #define EventFilter_CSCRawToDigi_CSCAnodeData_h -#include -#include -#include "DataFormats/CSCDigi/interface/CSCWireDigi.h" + #include "EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h" +#include class CSCALCTHeader; diff --git a/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h b/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h index 03ac125a6c41f..7b707402111e7 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h +++ b/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h @@ -1,7 +1,9 @@ #ifndef EventFilter_CSCRawToDigi_CSCAnodeDataFormat_h #define EventFilter_CSCRawToDigi_CSCAnodeDataFormat_h + #include "DataFormats/CSCDigi/interface/CSCWireDigi.h" #include + class CSCAnodeDataFormat { public: virtual ~CSCAnodeDataFormat() {} diff --git a/EventFilter/CSCRawToDigi/interface/CSCEventData.h b/EventFilter/CSCRawToDigi/interface/CSCEventData.h index 8cafdee0c805b..b36482e9ebf95 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCEventData.h +++ b/EventFilter/CSCRawToDigi/interface/CSCEventData.h @@ -23,9 +23,6 @@ class CSCStripDigi; #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include -/// Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7) -#define MAX_CFEB 7 - class CSCEventData { public: explicit CSCEventData(int chamberType, uint16_t format_version = 2005); @@ -159,7 +156,7 @@ class CSCEventData { CSCTMBData *theTMBData; /// for up to MAX_CFEB CFEB boards - CSCCFEBData *theCFEBData[MAX_CFEB]; + CSCCFEBData *theCFEBData[CSCConstants::MAX_CFEBS_RUN2]; CSCDMBTrailer theDMBTrailer; diff --git a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h index 7d5809bac8a26..5a079e0261a58 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h +++ b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h @@ -5,6 +5,7 @@ #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include #include #include diff --git a/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc b/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc index f9715b1a794ec..a5d73400a630a 100644 --- a/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc +++ b/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc @@ -29,6 +29,8 @@ #include "DataFormats/FEDRawData/interface/FEDNumbering.h" //Digi stuff + +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" @@ -536,7 +538,7 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { /// fill cfeb status digi if (unpackStatusDigis) { - for (icfeb = 0; icfeb < 7; ++icfeb) ///loop over status digis + for (icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) ///loop over status digis { if (cscData[iCSC].cfebData(icfeb) != nullptr) cfebStatusProduct->insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi()); @@ -554,7 +556,7 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { } /// fill wire, strip and comparator digis... - for (int ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { /// set layer, dmb and vme are valid because already checked in line 240 // (You have to be kidding. Line 240 in whose universe?) @@ -565,7 +567,7 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { wireProduct->move(std::make_pair(wireDigis.begin(), wireDigis.end()), layer); } - for (icfeb = 0; icfeb < 7; ++icfeb) { + for (icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { layer = pcrate->detId(vmecrate, dmb, icfeb, ilayer); if (cscData[iCSC].cfebData(icfeb) && cscData[iCSC].cfebData(icfeb)->check()) { std::vector stripDigis; diff --git a/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc b/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc index 7b8ad159f766f..a06a7315f30b4 100644 --- a/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc @@ -2,6 +2,7 @@ #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h" #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2006.h" #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2007.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include // for bzero @@ -26,7 +27,7 @@ CSCAnodeData::CSCAnodeData(const CSCALCTHeader &header, const unsigned short *bu std::vector > CSCAnodeData::wireDigis() const { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { result.push_back(wireDigis(layer)); } return result; diff --git a/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc b/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc index 769c61a120a5b..279f76d806535 100644 --- a/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc +++ b/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc @@ -1,5 +1,6 @@ #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2006.h" #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include // for bzero #include @@ -17,7 +18,7 @@ CSCAnodeData2006::CSCAnodeData2006(const CSCALCTHeader &header) ///for digi->ra bzero(theDataFrames, sizeInWords() * 2); for (int afeb = 0; afeb < nAFEBs_; ++afeb) { for (int tbin = 0; tbin < nTimeBins_; ++tbin) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { for (int halfLayer = 0; halfLayer < 2; ++halfLayer) { theDataFrames[index(afeb, tbin, layer) + halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame(); } diff --git a/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc b/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc index 903562ca4df2d..04202068770a7 100644 --- a/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc +++ b/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc @@ -1,5 +1,6 @@ #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2007.h" #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include // for bzero #include @@ -73,7 +74,7 @@ CSCAnodeDataFrame2007 CSCAnodeData2007::findFrame(int tbin, int layer, int layer int CSCAnodeData2007::index(int tbin, int layer, int layerPart) const { assert(tbin < nTimeBins_); - assert(layer <= 6); + assert(layer <= CSCDetId::maxLayerId()); assert(layerPart < layerParts_); int result = tbin * 6 * layerParts_ + (layer - 1) * layerParts_ + layerPart; assert(result < MAXFRAMES); diff --git a/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc b/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc index 751232a193af2..09d3025f2088f 100644 --- a/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc @@ -1,10 +1,10 @@ - -#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBTimeSlice.h" #include "EventFilter/CSCRawToDigi/interface/CSCBadCFEBTimeSlice.h" #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -200,8 +200,6 @@ CSCCFEBStatusDigi CSCCFEBData::statusDigi() const { } void CSCCFEBData::digis(uint32_t idlayer, std::vector &result) const { - // assert(layer>0 && layer <= 6); - LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples in CSCCFEBData::digis = " << nTimeSamples(); if (nTimeSamples() == 0) { LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?"; @@ -267,23 +265,23 @@ void CSCCFEBData::digis(uint32_t idlayer, std::vector &result) con if (theFormatVersion == 2013) { /// Handle 2013 Format if (me1a) - strip = strip % 64; // reset 65-112/ to 1-48 digi + strip = strip % CSCConstants::NUM_STRIPS_ME1B; // reset 65-112/ to 1-48 digi if (me1a && zplus) { - strip = 49 - strip; + strip = CSCConstants::NUM_STRIPS_ME1A_UNGANGED + 1 - strip; } // 1-48 -> 48-1 if (me1b && !zplus) { - strip = 65 - strip; + strip = CSCConstants::NUM_STRIPS_ME1B + 1 - strip; } // 1-64 -> 64-1 ... } else { // Handle original 2005 format if (me1a) - strip = strip % 64; // reset 65-80 to 1-16 digi + strip = strip % CSCConstants::NUM_STRIPS_ME1B; // reset 65-80 to 1-16 digi if (me1a && zplus) { - strip = 17 - strip; + strip = CSCConstants::NUM_STRIPS_ME1A_GANGED + 1 - strip; } // 1-16 -> 16-1 if (me1b && !zplus) { - strip = 65 - strip; + strip = CSCConstants::NUM_STRIPS_ME1B + 1 - strip; } // 1-64 -> 64-1 ... } result.push_back(CSCStripDigi(strip, sca, overflow, overlap, errorfl)); @@ -291,7 +289,6 @@ void CSCCFEBData::digis(uint32_t idlayer, std::vector &result) con } std::vector CSCCFEBData::digis(unsigned idlayer) const { - //assert(layer>0 && layer <= 6); std::vector result; uint32_t layer = idlayer; digis(layer, result); @@ -310,7 +307,7 @@ bool CSCCFEBData::check() const { std::ostream &operator<<(std::ostream &os, const CSCCFEBData &data) { os << "printing CFEB data sample by sample " << std::endl; - for (unsigned ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { for (unsigned channel = 1; channel <= 16; ++channel) { unsigned strip = channel + data.boardNumber_ * 16; os << "Strip " << strip << " "; @@ -325,7 +322,7 @@ std::ostream &operator<<(std::ostream &os, const CSCCFEBData &data) { std::vector > CSCCFEBData::stripDigis() { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { result.push_back(digis(layer)); } return result; diff --git a/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc b/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc index bf9c2542736b0..547fbf85fc5ed 100644 --- a/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc +++ b/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc @@ -1,3 +1,4 @@ +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBTimeSlice.h" #include #include @@ -29,7 +30,8 @@ CSCCFEBSCAControllerWord::CSCCFEBSCAControllerWord(unsigned short frame) } CSCCFEBDataWord *CSCCFEBTimeSlice::timeSample(int layer, int channel, bool isDCFEB) const { - assert(layer >= 1 && layer <= 6); + assert(layer >= CSCDetId::minLayerId()); + assert(layer <= CSCDetId::maxLayerId()); assert(channel >= 1 && channel <= 16); int layerIndex = layerInverseGrayCode[layer - 1]; @@ -50,7 +52,7 @@ CSCCFEBSCAControllerWord CSCCFEBTimeSlice::scaControllerWord(int layer) const { } void CSCCFEBTimeSlice::setControllerWord(const CSCCFEBSCAControllerWord &controllerWord) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { for (int channel = 1; channel <= 16; ++channel) { const unsigned short *shortWord = reinterpret_cast(&controllerWord); timeSample(layer, channel)->controllerData = (*shortWord >> (channel - 1)) & 1; @@ -68,7 +70,7 @@ unsigned CSCCFEBTimeSlice::calcCRC() const { std::ostream &operator<<(std::ostream &os, const CSCCFEBTimeSlice &slice) { for (int ichannel = 1; ichannel <= 16; ++ichannel) { - for (int ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { //unsigned index = (ilayer-1) + (ichannel-1)*6; //int value = (slice.timeSample(index))->adcCounts - 560; int value = (slice.timeSample(ilayer, ichannel))->adcCounts - 560; diff --git a/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc b/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc index 6e30fc550d4bf..dfe87b1b1cc13 100644 --- a/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc @@ -1,6 +1,7 @@ #include "EventFilter/CSCRawToDigi/interface/CSCComparatorData.h" #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -41,7 +42,7 @@ CSCComparatorData::CSCComparatorData(int ncfebs, int ntbins, const unsigned shor void CSCComparatorData::zero() { for (int ifeb = 0; ifeb < ncfebs_; ++ifeb) { for (int tbin = 0; tbin < ntbins_; ++tbin) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { dataWord(ifeb, tbin, layer) = CSCComparatorDataWord(ifeb, tbin, 0); } } @@ -53,16 +54,18 @@ std::vector CSCComparatorData::comparatorDigis(uint32_t idlay bool me1a = (CSCDetId::station(idlayer) == 1) && (CSCDetId::ring(idlayer) == 4); bool zplus = (CSCDetId::endcap(idlayer) == 1); bool me1b = (CSCDetId::station(idlayer) == 1) && (CSCDetId::ring(idlayer) == 1); - // bool me11 = (CSCDetId::station(idlayer)==1) && ((CSCDetId::ring(idlayer)==1) || (CSCDetId::ring(idlayer)==4)); - unsigned layer = CSCDetId::layer(idlayer); + int layer = CSCDetId::layer(idlayer); + + assert(layer >= CSCDetId::minLayerId()); + assert(layer <= CSCDetId::maxLayerId()); //looking for comp output on layer std::vector result; - assert(layer > 0 && layer <= 6); + // this is pretty sparse data, so I wish we could check the // data word by word, not bit by bit, but I don't see how to // do the time sequencing that way. - for (int distrip = 0; distrip < 8; ++distrip) { + for (int distrip = 0; distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB; ++distrip) { uint16_t tbinbitsS0HS0 = 0; uint16_t tbinbitsS0HS1 = 0; uint16_t tbinbitsS1HS0 = 0; @@ -78,18 +81,18 @@ std::vector CSCComparatorData::comparatorDigis(uint32_t idlay int bit2 = bitValue(cfeb, tbin + 1, layer, distrip); int bit3 = bitValue(cfeb, tbin + 2, layer, distrip); // should count from zero - int chamberDistrip = distrip + cfeb * 8; + int chamberDistrip = distrip + cfeb * CSCConstants::NUM_DISTRIPS_PER_CFEB; int HalfStrip = 4 * chamberDistrip + bit2 * 2 + bit3; int output = 4 + bit2 * 2 + bit3; /* - * Handles distrip logic; comparator output is for pairs of strips: - * hit bin dec - * x--- 100 4 - * -x-- 101 5 - * --x- 110 6 - * ---x 111 7 - * - */ + * Handles distrip logic; comparator output is for pairs of strips: + * hit bin dec + * x--- 100 4 + * -x-- 101 5 + * --x- 110 6 + * ---x 111 7 + * + */ if (debug) LogTrace("CSCComparatorData|CSCRawToDigi") @@ -177,10 +180,10 @@ std::vector CSCComparatorData::comparatorDigis(uint32_t idlay } std::vector CSCComparatorData::comparatorDigis(int layer) { - //returns comparators for one layer for all cfebs - std::vector result; - assert(layer > 0 && layer <= 6); + assert(layer >= CSCDetId::minLayerId()); + assert(layer <= CSCDetId::maxLayerId()); + std::vector result; for (int cfeb = 0; cfeb < ncfebs_; ++cfeb) { std::vector oneCfebDigi = comparatorDigis(layer, cfeb); result.insert(result.end(), oneCfebDigi.begin(), oneCfebDigi.end()); @@ -190,15 +193,16 @@ std::vector CSCComparatorData::comparatorDigis(int layer) { } void CSCComparatorData::add(const CSCComparatorDigi& digi, int layer) { - //FIXME do flipping int strip = digi.getStrip(); - int halfStrip = (strip - 1) * 2 + digi.getComparator(); - int cfeb = (strip - 1) / 16; - int distrip = ((strip - 1) % 16) / 2; + int halfstrip = digi.getHalfStrip(); + int cfeb = digi.getCFEB(); + int distrip = digi.getDiStrip(); - // assert(distrip < 8 && cfeb < 6 && halfStrip < 161); - ///!!! Do we need to introduce format version here to accomodate 7 CFEBs - assert(distrip < 8 && cfeb < 8 && halfStrip < 225); + // Check the distrip and half-strip number + assert(cfeb < CSCConstants::MAX_CFEBS_RUN2); + assert(distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB); + // note that half-strips are not staggered in the packer + assert(halfstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2); std::vector timeBinsOn = digi.getTimeBinsOn(); for (std::vector::const_iterator tbinItr = timeBinsOn.begin(); tbinItr != timeBinsOn.end(); ++tbinItr) { @@ -225,52 +229,55 @@ void CSCComparatorData::add(const CSCComparatorDigi& digi, const CSCDetId& cid) bool me1a = (cid.station() == 1) && (cid.ring() == 4); bool zplus = (cid.endcap() == 1); bool me1b = (cid.station() == 1) && (cid.ring() == 1); - // bool me11 = (cid.station()==1) && ((cid.ring()==1) || (cid.ring()==4)); unsigned layer = cid.layer(); int strip = digi.getStrip(); - int halfstrip = (strip - 1) * 2 + digi.getComparator(); - int cfeb = (strip - 1) / 16; - int distrip = ((strip - 1) % 16) / 2; + int halfstrip = digi.getHalfStrip(); + int cfeb = digi.getCFEB(); + int distrip = digi.getDiStrip(); int bit2 = (strip - 1) % 2; int bit3 = digi.getComparator(); - // assert(distrip < 8 && cfeb < 6 && halfStrip < 161); - ///!!! Do we need to introduce format version here to accomodate 7 CFEBs + // Check the distrip and half-strip number if (theFirmwareVersion >= 2013) { - assert(distrip < 8 && cfeb < 8 && halfstrip < 225); + assert(cfeb < CSCConstants::MAX_CFEBS_RUN2); + assert(distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB); + // note that half-strips are not staggered in the packer + assert(halfstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2); } else { - assert(distrip < 8 && cfeb < 6 && halfstrip < 161); + assert(cfeb < CSCConstants::MAX_CFEBS_RUN1); + assert(distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB); + // note that half-strips are not staggered in the packer + assert(halfstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN1); } // Lets try to do ME11 strip flipping if (doStripSwapping) { if (theFirmwareVersion >= 2013) { - if ((me1a || (me1b && (cfeb > 3))) && zplus) { + if ((me1a || (me1b && (cfeb > CSCConstants::NUM_CFEBS_ME1A_UNGANGED))) && zplus) { distrip = 7 - distrip; // 0-7 -> 7-0 cfeb = 10 - cfeb; - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } - if (me1b && !zplus && (cfeb < 4)) { + if (me1b && !zplus && (cfeb < CSCConstants::NUM_CFEBS_ME1B)) { distrip = 7 - distrip; cfeb = 3 - cfeb; - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } } else { - // if ( me1a ) { cfeb_corr = 0; } // reset 4 to 0 - if ((me1a || (me1b && (cfeb > 3))) && zplus) { + if ((me1a || (me1b && (cfeb > CSCConstants::NUM_CFEBS_ME1A_UNGANGED))) && zplus) { distrip = 7 - distrip; // 0-7 -> 7-0 - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } - if (me1b && !zplus && (cfeb < 4)) { + if (me1b && !zplus && (cfeb < CSCConstants::NUM_CFEBS_ME1B)) { distrip = 7 - distrip; cfeb = 3 - cfeb; - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } } } @@ -298,7 +305,7 @@ bool CSCComparatorData::check() const { bool result = true; for (int cfeb = 0; cfeb < ncfebs_; ++cfeb) { for (int tbin = 0; tbin < ntbins_; ++tbin) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { /// first do some checks const CSCComparatorDataWord& word = dataWord(cfeb, tbin, layer); bool wordIsGood = (word.tbin_ == tbin) && (word.cfeb_ == cfeb); diff --git a/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc b/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc index 5745f296fbe4e..c09c24f196f65 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc @@ -1,4 +1,5 @@ #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader2013.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include CSCDMBHeader2013::CSCDMBHeader2013() { @@ -56,12 +57,12 @@ unsigned CSCDMBHeader2013::sizeInWords() const { return 8; } /// counts from zero bool CSCDMBHeader2013::cfebAvailable(unsigned icfeb) { - assert(icfeb < 7); + assert(icfeb < CSCConstants::MAX_CFEBS_RUN2); return (cfebAvailable() >> icfeb) & 1; } void CSCDMBHeader2013::addCFEB(int icfeb) { - assert(icfeb < 7); + assert(icfeb < CSCConstants::MAX_CFEBS_RUN2); bits.cfeb_dav |= (1 << icfeb); bits.cfeb_clct_sent |= (1 << icfeb); } diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc index 1f1c74618a6ea..66f933d7c83f2 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc @@ -5,6 +5,7 @@ */ #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h" #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" @@ -161,28 +162,30 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, for (; digiItr != last; ++digiItr) { CSCStripDigi digi = *digiItr; int strip = digi.getStrip(); + // From LS1 on ME1a strips are unganged if (fedInfo.formatVersion_ == 2013) { if (me1a && zplus) { - digi.setStrip(49 - strip); // 1-48 -> 48-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1A_UNGANGED + 1 - strip); // 1-48 -> 48-1 } if (me1b && !zplus) { - digi.setStrip(65 - strip); // 1-64 -> 64-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1B + 1 - strip); // 1-64 -> 64-1 } if (me1a) { strip = digi.getStrip(); // reset back 1-16 to 65-80 digi - digi.setStrip(strip + 64); + digi.setStrip(strip + CSCConstants::NUM_STRIPS_ME1B); } - - } else { + } + // During Run-1 ME1a strips are triple-ganged + else { if (me1a && zplus) { - digi.setStrip(17 - strip); // 1-16 -> 16-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1A_GANGED + 1 - strip); // 1-16 -> 16-1 } if (me1b && !zplus) { - digi.setStrip(65 - strip); // 1-64 -> 64-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1B + 1 - strip); // 1-64 -> 64-1 } if (me1a) { strip = digi.getStrip(); // reset back 1-16 to 65-80 digi - digi.setStrip(strip + 64); + digi.setStrip(strip + CSCConstants::NUM_STRIPS_ME1B); } } cscData.add(digi, cscDetId.layer()); @@ -222,23 +225,28 @@ void CSCDigiToRaw::add(const CSCComparatorDigiCollection& comparatorDigis, if (packEverything || cscd2r::accept(cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, me1abCheck)) { bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4); + /* + Add the comparator digi to the fedInfo. + Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not + been done already. + Consider the case for triple-ganged and unganged ME1A strips + */ for (auto digi = j.second.first; digi != j.second.second; ++digi) { if (fedInfo.formatVersion_ == 2013) { - // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not - // been done already. - if (me1a && digi->getStrip() <= 48) { - CSCComparatorDigi digi_corr(64 + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); - cscData.add(digi_corr, cscDetId); // This version does ME11 strips swapping - // cscData.add(digi_corr, cscDetId.layer()); // This one doesn't + // unganged case + if (me1a && digi->getStrip() <= CSCConstants::NUM_STRIPS_ME1A_UNGANGED) { + CSCComparatorDigi digi_corr( + CSCConstants::NUM_STRIPS_ME1B + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); + cscData.add(digi_corr, cscDetId); } else { - cscData.add(*digi, cscDetId); // This version does ME11 strips swapping - // cscData.add(digi, cscDetId.layer()); // This one doesn't + cscData.add(*digi, cscDetId); } - } else { - // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not - // been done already. - if (me1a && digi->getStrip() <= 16) { - CSCComparatorDigi digi_corr(64 + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); + } + // triple-ganged case + else { + if (me1a && digi->getStrip() <= CSCConstants::NUM_STRIPS_ME1A_GANGED) { + CSCComparatorDigi digi_corr( + CSCConstants::NUM_STRIPS_ME1B + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); cscData.add(digi_corr, cscDetId.layer()); } else { cscData.add(*digi, cscDetId.layer()); @@ -270,14 +278,14 @@ void CSCDigiToRaw::add(const CSCCLCTDigiCollection& clctDigis, FindEventDataInfo if (me11a && fedInfo.formatVersion_ == 2013) { std::vector shiftedDigis((*j).second.first, (*j).second.second); for (std::vector::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) { - if (iC->getCFEB() < 3) { //sanity check, mostly + if (iC->getCFEB() < CSCConstants::NUM_CFEBS_ME1A_UNGANGED) { //sanity check, mostly (*iC) = CSCCLCTDigi(iC->isValid(), iC->getQuality(), iC->getPattern(), iC->getStripType(), iC->getBend(), iC->getStrip(), - iC->getCFEB() + 4, + iC->getCFEB() + CSCConstants::NUM_CFEBS_ME1B, iC->getBX(), iC->getTrknmb(), iC->getFullBX()); @@ -302,12 +310,12 @@ void CSCDigiToRaw::add(const CSCCorrelatedLCTDigiCollection& corrLCTDigis, FindE if (me11a && fedInfo.formatVersion_ == 2013) { std::vector shiftedDigis((*j).second.first, (*j).second.second); for (std::vector::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) { - if (iC->getStrip() < 96) { //sanity check, mostly + if (iC->getStrip() < CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED) { //sanity check, mostly (*iC) = CSCCorrelatedLCTDigi(iC->getTrknmb(), iC->isValid(), iC->getQuality(), iC->getKeyWG(), - iC->getStrip() + 128, + iC->getStrip() + CSCConstants::NUM_HALF_STRIPS_ME1B, iC->getPattern(), iC->getBend(), iC->getBX(), @@ -364,20 +372,13 @@ void CSCDigiToRaw::createFedBuffers(const CSCStripDigiCollection& stripDigis, } int l1a = eid.event(); //need to add increments or get it from lct digis int bx = l1a; //same as above - //int startingFED = FEDNumbering::MINCSCFEDID; if (fedInfo.formatVersion_ == 2005) /// Handle pre-LS1 format data { std::map dccMap; + //idcc goes from startingFed to startingFED+7 for (int idcc = FEDNumbering::MINCSCFEDID; idcc <= FEDNumbering::MAXCSCFEDID; ++idcc) { - //idcc goes from startingFed to startingFED+7 - // @@ if ReadoutMapping changes, this'll have to change - // DCCs 1,2,4,5 have 5 DDUs. Otherwise, 4 - //int nDDUs = (idcc < 2) || (idcc ==4) || (idcc ==5) - // ? 5 : 4; - //@@ WARNING some DCCs only have 4 DDUs, but I'm giving them all 5, for now - int nDDUs = 5; - dccMap.insert(std::pair(idcc, CSCDCCEventData(idcc, nDDUs, bx, l1a))); + dccMap.insert(std::pair(idcc, CSCDCCEventData(idcc, CSCConstants::NUM_DDUS, bx, l1a))); } for (int idcc = FEDNumbering::MINCSCFEDID; idcc <= FEDNumbering::MAXCSCFEDID; ++idcc) { @@ -417,9 +418,9 @@ void CSCDigiToRaw::createFedBuffers(const CSCStripDigiCollection& stripDigis, 0, 0); } - - } else if (format_version == 2013) /// Handle post-LS1 format data - { + } + /// Handle post-LS1 format data + else if (format_version == 2013) { std::map dduMap; unsigned int ddu_fmt_version = 0x7; /// 2013 Format const unsigned postLS1_map[] = {841, 842, 843, 844, 845, 846, 847, 848, 849, 831, 832, 833, diff --git a/EventFilter/CSCRawToDigi/src/CSCEventData.cc b/EventFilter/CSCRawToDigi/src/CSCEventData.cc index 6e6ba75e0143e..ccfd2957d214c 100644 --- a/EventFilter/CSCRawToDigi/src/CSCEventData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCEventData.cc @@ -1,12 +1,13 @@ #include "EventFilter/CSCRawToDigi/interface/CSCEventData.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h" +#include "EventFilter/CSCRawToDigi/interface/cscPackerCompare.h" +#include "EventFilter/CSCRawToDigi/interface/bitset_append.h" #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "EventFilter/CSCRawToDigi/interface/cscPackerCompare.h" +#include "FWCore/Utilities/interface/Exception.h" #include #include -#include "EventFilter/CSCRawToDigi/interface/bitset_append.h" -#include "FWCore/Utilities/interface/Exception.h" #ifdef LOCAL_UNPACK bool CSCEventData::debug = false; @@ -25,7 +26,7 @@ CSCEventData::CSCEventData(int chamberType, uint16_t format_version) alctZSErecovered(nullptr), zseEnable(0), theFormatVersion(format_version) { - for (unsigned i = 0; i < MAX_CFEB; ++i) { + for (unsigned i = 0; i < CSCConstants::MAX_CFEBS_RUN2; ++i) { theCFEBData[i] = nullptr; } } @@ -216,7 +217,7 @@ void CSCEventData::unpack_data(const uint16_t* buf) { } } if (dmbTrailerReached) { - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { theCFEBData[icfeb] = nullptr; int cfeb_available = theDMBHeader.cfebAvailable(icfeb); unsigned int cfebTimeout = theDMBTrailer.cfeb_starttimeout() | theDMBTrailer.cfeb_endtimeout(); @@ -272,7 +273,7 @@ void CSCEventData::init() { theAnodeData = nullptr; theALCTTrailer = nullptr; theTMBData = nullptr; - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { theCFEBData[icfeb] = nullptr; } alctZSErecovered = nullptr; @@ -292,7 +293,7 @@ void CSCEventData::copy(const CSCEventData& data) { theALCTTrailer = new CSCALCTTrailer(*(data.theALCTTrailer)); if (data.theTMBData != nullptr) theTMBData = new CSCTMBData(*(data.theTMBData)); - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { theCFEBData[icfeb] = nullptr; if (data.theCFEBData[icfeb] != nullptr) theCFEBData[icfeb] = new CSCCFEBData(*(data.theCFEBData[icfeb])); @@ -309,7 +310,7 @@ void CSCEventData::destroy() { delete theAnodeData; delete theALCTTrailer; delete theTMBData; - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { delete theCFEBData[icfeb]; } /* @@ -321,7 +322,7 @@ void CSCEventData::destroy() { std::vector CSCEventData::stripDigis(const CSCDetId& idlayer) const { std::vector result; - for (unsigned icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (unsigned icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { std::vector newDigis = stripDigis(idlayer, icfeb); result.insert(result.end(), newDigis.begin(), newDigis.end()); } @@ -329,7 +330,6 @@ std::vector CSCEventData::stripDigis(const CSCDetId& idlayer) cons } std::vector CSCEventData::stripDigis(unsigned idlayer, unsigned icfeb) const { - // assert(ilayer > 0 && ilayer <= 6); // off because now idlayer is raw cscdetid std::vector result; if (theCFEBData[icfeb] != nullptr) { std::vector newDigis = theCFEBData[icfeb]->digis(idlayer); @@ -349,7 +349,7 @@ std::vector CSCEventData::wireDigis(unsigned ilayer) const { std::vector > CSCEventData::stripDigis() const { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { std::vector digis = stripDigis(layer); result.push_back(digis); } @@ -358,7 +358,7 @@ std::vector > CSCEventData::stripDigis() const { std::vector > CSCEventData::wireDigis() const { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { result.push_back(wireDigis(layer)); } return result; @@ -414,20 +414,14 @@ void CSCEventData::setEventInformation(int bxnum, int lvl1num) { assert(theChamberType > 0); - theTMBData->tmbHeader()->setNCFEBs(5); + theTMBData->tmbHeader()->setNCFEBs(CSCConstants::MAX_CFEBS_RUN1); // Set number of CFEBs to 7 for Post-LS1 ME11 if ((theFormatVersion == 2013) && ((theChamberType == 1) || (theChamberType == 2))) { - theTMBData->tmbHeader()->setNCFEBs(7); + theTMBData->tmbHeader()->setNCFEBs(CSCConstants::MAX_CFEBS_RUN2); } - /* - // Set number of CFEBs to 4 for ME13 chambers - if (theChamberType == 4) { - theTMBData->tmbHeader()->setNCFEBs(4); - } -*/ } - for (unsigned cfeb = 0; cfeb < 7; cfeb++) { + for (unsigned cfeb = 0; cfeb < CSCConstants::MAX_CFEBS_RUN2; cfeb++) { if (theCFEBData[cfeb]) theCFEBData[cfeb]->setL1A(lvl1num); } @@ -447,9 +441,9 @@ void CSCEventData::checkALCTClasses() { } void CSCEventData::checkTMBClasses() { - int nCFEBs = 5; + int nCFEBs = CSCConstants::MAX_CFEBS_RUN1; if ((theFormatVersion == 2013) && ((theChamberType == 1) || (theChamberType == 2))) { - nCFEBs = 7; + nCFEBs = CSCConstants::MAX_CFEBS_RUN2; } if (theTMBData == nullptr) { if (theFormatVersion == 2013) { // Set to TMB format for Post-LS1 data @@ -466,7 +460,7 @@ void CSCEventData::checkTMBClasses() { void CSCEventData::add(const CSCStripDigi& digi, int layer) { //@@ need special logic here for ME11 - unsigned cfeb = (digi.getStrip() - 1) / 16; + unsigned cfeb = digi.getCFEB(); bool sixteenSamples = false; if (digi.getADCCounts().size() == 16) sixteenSamples = true; @@ -515,7 +509,7 @@ void CSCEventData::add(const std::vector& digis) { void CSCEventData::add(const std::vector& clusters, const GEMDetId&) { checkTMBClasses(); } std::ostream& operator<<(std::ostream& os, const CSCEventData& evt) { - for (int ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { std::vector stripDigis = evt.stripDigis(ilayer); //copy(stripDigis.begin(), stripDigis.end(), std::ostream_iterator(os, "\n")); //print your scas here @@ -554,7 +548,7 @@ boost::dynamic_bitset<> CSCEventData::pack() { result = bitset_utilities::append(result, theTMBData->pack()); } - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { if (theCFEBData[icfeb] != nullptr) { boost::dynamic_bitset<> cfebData = bitset_utilities::ushortToBitset(theCFEBData[icfeb]->sizeInWords() * 16, theCFEBData[icfeb]->data()); diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc index c0668a9f2ccf2..ef5c07eaba7b8 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc @@ -26,8 +26,8 @@ void CSCTMBHeader2007_rev0x50c3::setEventInformation(const CSCDMBHeader& dmbHead std::vector CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer) { std::vector result; int halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); - int strip = halfstrip % 32; - int cfeb = halfstrip / 32; + int strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + int cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; int pattern = bits.clct0_shape; int bend = pattern & 0x1; @@ -37,8 +37,8 @@ std::vector CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer) //digi0.setFullBX(bits.bxnPreTrigger); halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); - strip = halfstrip % 32; - cfeb = halfstrip / 32; + strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; pattern = bits.clct1_shape; bend = pattern & 0x1; diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc index 1ab0a318628ec..1c79a290a8ec1 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc @@ -24,8 +24,8 @@ void CSCTMBHeader2013::setEventInformation(const CSCDMBHeader& dmbHeader) { std::vector CSCTMBHeader2013::CLCTDigis(uint32_t idlayer) { std::vector result; int halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); - int strip = halfstrip % 32; - int cfeb = halfstrip / 32; + int strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + int cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; int pattern = bits.clct0_shape; int bend = pattern & 0x1; @@ -35,8 +35,8 @@ std::vector CSCTMBHeader2013::CLCTDigis(uint32_t idlayer) { //digi0.setFullBX(bits.bxnPreTrigger); halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); - strip = halfstrip % 32; - cfeb = halfstrip / 32; + strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; pattern = bits.clct1_shape; bend = pattern & 0x1; diff --git a/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc b/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc index ae046ca04303b..6d97bcc8162b3 100644 --- a/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc +++ b/EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc @@ -127,11 +127,11 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve uint32_t amc13EvtLength = 0; std::unique_ptr amc13Event = std::make_unique(); - for (uint8_t amcNum = 0; amcNum < GEMeMap::maxAMCs_; ++amcNum) { + for (uint8_t amcNum = 0; amcNum <= GEMeMap::maxAMCs_; ++amcNum) { uint32_t amcSize = 0; std::unique_ptr amcData = std::make_unique(); - for (uint8_t gebId = 0; gebId < GEMeMap::maxGEBs_; ++gebId) { + for (uint8_t gebId = 0; gebId <= GEMeMap::maxGEBs_; ++gebId) { std::unique_ptr gebData = std::make_unique(); GEMROMapping::chamEC geb_ec{fedId, amcNum, gebId}; diff --git a/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc b/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc index 97e482e93a78d..a318ba694fae3 100644 --- a/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc +++ b/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc @@ -2,7 +2,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/L1TMuon/interface/OMTF/OmtfCscDataWord64.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" namespace omtf { diff --git a/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc b/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc index 99924ba24acea..0a7e406707125 100644 --- a/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc +++ b/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc @@ -1,11 +1,8 @@ #include "EventFilter/L1TRawToDigi/interface/OmtfCscUnpacker.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" - #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" - +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/L1TMuon/interface/OMTF/OmtfCscDataWord64.h" namespace omtf { diff --git a/FWCore/Framework/interface/EDLooperBase.h b/FWCore/Framework/interface/EDLooperBase.h index ceb0fb3071ada..96f6854a7ffc2 100644 --- a/FWCore/Framework/interface/EDLooperBase.h +++ b/FWCore/Framework/interface/EDLooperBase.h @@ -54,6 +54,7 @@ // #include "DataFormats/Provenance/interface/ModuleDescription.h" +#include "FWCore/Framework/interface/EDConsumerBase.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" #include "FWCore/Utilities/interface/propagate_const.h" @@ -74,12 +75,12 @@ namespace edm { class ProcessingController; class ActivityRegistry; - class EDLooperBase { + class EDLooperBase : public EDConsumerBase { public: enum Status { kContinue, kStop }; EDLooperBase(); - virtual ~EDLooperBase() noexcept(false); + ~EDLooperBase() noexcept(false) override; EDLooperBase(EDLooperBase const&) = delete; // Disallow copying and moving EDLooperBase& operator=(EDLooperBase const&) = delete; // Disallow copying and moving diff --git a/FWCore/Framework/src/EDLooperBase.cc b/FWCore/Framework/src/EDLooperBase.cc index 85ba5e0ccbcb7..a762451bada14 100644 --- a/FWCore/Framework/src/EDLooperBase.cc +++ b/FWCore/Framework/src/EDLooperBase.cc @@ -52,11 +52,13 @@ namespace edm { ParentContext parentContext(streamContext); ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext); Event event(eventPrincipal, moduleDescription_, &moduleCallingContext_); + event.setConsumer(this); Status status = kContinue; try { ESParentContext parentC(&moduleCallingContext_); - const EventSetup es{esi, static_cast(Transition::Event), nullptr, parentC, false}; + const EventSetup es{ + esi, static_cast(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false}; status = duringLoop(event, es, ioController); } catch (cms::Exception& e) { e.addContext("Calling the 'duringLoop' method of a looper"); @@ -72,7 +74,8 @@ namespace edm { EDLooperBase::Status EDLooperBase::doEndOfLoop(const edm::EventSetupImpl& esi) { ESParentContext parentC(&moduleCallingContext_); - const EventSetup es{esi, static_cast(Transition::EndRun), nullptr, parentC, false}; + const EventSetup es{ + esi, static_cast(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false}; return endOfLoop(es, iCounter_); } @@ -86,7 +89,11 @@ namespace edm { void EDLooperBase::beginOfJob(const edm::EventSetupImpl& iImpl) { ESParentContext parentC(&moduleCallingContext_); - beginOfJob(EventSetup{iImpl, static_cast(Transition::BeginRun), nullptr, parentC, false}); + beginOfJob(EventSetup{iImpl, + static_cast(Transition::BeginRun), + esGetTokenIndices(Transition::BeginRun), + parentC, + false}); } void EDLooperBase::beginOfJob(const edm::EventSetup&) { beginOfJob(); } void EDLooperBase::beginOfJob() {} @@ -103,8 +110,10 @@ namespace edm { ParentContext parentContext(&globalContext); ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext); Run run(iRP, moduleDescription_, &moduleCallingContext_, false); + run.setConsumer(this); ESParentContext parentC(&moduleCallingContext_); - const EventSetup es{iES, static_cast(Transition::BeginRun), nullptr, parentC, false}; + const EventSetup es{ + iES, static_cast(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC, false}; beginRun(run, es); } @@ -118,8 +127,10 @@ namespace edm { ParentContext parentContext(&globalContext); ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext); Run run(iRP, moduleDescription_, &moduleCallingContext_, true); + run.setConsumer(this); ESParentContext parentC(&moduleCallingContext_); - const EventSetup es{iES, static_cast(Transition::EndRun), nullptr, parentC, false}; + const EventSetup es{ + iES, static_cast(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false}; endRun(run, es); } void EDLooperBase::doBeginLuminosityBlock(LuminosityBlockPrincipal& iLB, @@ -134,8 +145,13 @@ namespace edm { ParentContext parentContext(&globalContext); ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext); LuminosityBlock luminosityBlock(iLB, moduleDescription_, &moduleCallingContext_, false); + luminosityBlock.setConsumer(this); ESParentContext parentC(&moduleCallingContext_); - const EventSetup es{iES, static_cast(Transition::BeginLuminosityBlock), nullptr, parentC, false}; + const EventSetup es{iES, + static_cast(Transition::BeginLuminosityBlock), + esGetTokenIndices(Transition::BeginLuminosityBlock), + parentC, + false}; beginLuminosityBlock(luminosityBlock, es); } void EDLooperBase::doEndLuminosityBlock(LuminosityBlockPrincipal& iLB, @@ -150,8 +166,13 @@ namespace edm { ParentContext parentContext(&globalContext); ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext); LuminosityBlock luminosityBlock(iLB, moduleDescription_, &moduleCallingContext_, true); + luminosityBlock.setConsumer(this); ESParentContext parentC(&moduleCallingContext_); - const EventSetup es{iES, static_cast(Transition::EndLuminosityBlock), nullptr, parentC, false}; + const EventSetup es{iES, + static_cast(Transition::EndLuminosityBlock), + esGetTokenIndices(Transition::EndLuminosityBlock), + parentC, + false}; endLuminosityBlock(luminosityBlock, es); } diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 3674e0f1e2d6c..67fc7d6317743 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -641,6 +641,18 @@ namespace edm { } espController_->finishConfiguration(); schedule_->beginJob(*preg_, esp_->recordsToProxyIndices()); + if (looper_) { + constexpr bool mustPrefetchMayGet = true; + auto const processBlockLookup = preg_->productLookup(InProcess); + auto const runLookup = preg_->productLookup(InRun); + auto const lumiLookup = preg_->productLookup(InLumi); + auto const eventLookup = preg_->productLookup(InEvent); + looper_->updateLookup(InProcess, *processBlockLookup, mustPrefetchMayGet); + looper_->updateLookup(InRun, *runLookup, mustPrefetchMayGet); + looper_->updateLookup(InLumi, *lumiLookup, mustPrefetchMayGet); + looper_->updateLookup(InEvent, *eventLookup, mustPrefetchMayGet); + looper_->updateLookup(esp_->recordsToProxyIndices()); + } // toerror.succeeded(); // should we add this? for_all(subProcesses_, [](auto& subProcess) { subProcess.doBeginJob(); }); actReg_->postBeginJobSignal_(); diff --git a/FWCore/Framework/test/BuildFile.xml b/FWCore/Framework/test/BuildFile.xml index 785e7581cb6b4..3db71c8809aa7 100644 --- a/FWCore/Framework/test/BuildFile.xml +++ b/FWCore/Framework/test/BuildFile.xml @@ -138,7 +138,7 @@ - + diff --git a/FWCore/Framework/test/run_esproducerlooper.sh b/FWCore/Framework/test/run_esproducerlooper.sh index 5d64fee0e11aa..8b1c6165c0b7a 100755 --- a/FWCore/Framework/test/run_esproducerlooper.sh +++ b/FWCore/Framework/test/run_esproducerlooper.sh @@ -10,4 +10,4 @@ function die { echo $1: status $2 ; exit $2; } #(cmsRun ${LOCAL_TEST_DIR}/test_esproducerlooper_prefer_not_source_cfg.py ) || die 'Failure using test_esproducerlooper_prefer_not_source_cfg.py' $? (cmsRun ${LOCAL_TEST_DIR}/test_esproducerlooper_prefer_producer_cfg.py ) || die 'Failure using test_esproducerlooper_prefer_producer_cfg.py' $? (cmsRun ${LOCAL_TEST_DIR}/test_module_change_looper_cfg.py ) || die 'Failure using test_module_change_looper_cfg.py' $? - +(cmsRun ${LOCAL_TEST_DIR}/test_edlooper_consumes_cfg.py) || die 'Failure using test_edlooper_consumes_cfg.py' $? diff --git a/FWCore/Framework/test/stubs/IntTestLooper.cc b/FWCore/Framework/test/stubs/IntTestLooper.cc new file mode 100644 index 0000000000000..229b2ffe2c7b1 --- /dev/null +++ b/FWCore/Framework/test/stubs/IntTestLooper.cc @@ -0,0 +1,155 @@ +#include "DataFormats/TestObjects/interface/ToyProducts.h" +#include "FWCore/Framework/interface/ESProducerLooper.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/LooperFactory.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/transform.h" + +#include "FWCore/Framework/test/DummyData.h" +#include "FWCore/Framework/test/DummyRecord.h" + +namespace edmtest { + class IntTestLooper : public edm::ESProducerLooper { + public: + IntTestLooper(edm::ParameterSet const& iPSet) + : tokensBeginRun_(edm::vector_transform( + iPSet.getUntrackedParameter>("srcBeginRun"), + [this](edm::InputTag const& tag) { return this->consumes(tag); })), + tokensBeginLumi_(edm::vector_transform( + iPSet.getUntrackedParameter>("srcBeginLumi"), + [this](edm::InputTag const& tag) { return this->consumes(tag); })), + tokensEvent_( + edm::vector_transform(iPSet.getUntrackedParameter>("srcEvent"), + [this](edm::InputTag const& tag) { return this->consumes(tag); })), + tokensEndLumi_(edm::vector_transform( + iPSet.getUntrackedParameter>("srcEndLumi"), + [this](edm::InputTag const& tag) { return this->consumes(tag); })), + tokensEndRun_(edm::vector_transform( + iPSet.getUntrackedParameter>("srcEndRun"), + [this](edm::InputTag const& tag) { return this->consumes(tag); })), + esTokenBeginRun_(esConsumes()), + esToken_(esConsumes()), + valuesBeginRun_(iPSet.getUntrackedParameter>("expectBeginRunValues")), + valuesBeginLumi_(iPSet.getUntrackedParameter>("expectBeginLumiValues")), + valuesEvent_(iPSet.getUntrackedParameter>("expectEventValues")), + valuesEndLumi_(iPSet.getUntrackedParameter>("expectEndLumiValues")), + valuesEndRun_(iPSet.getUntrackedParameter>("expectEndRunValues")), + valueES_(iPSet.getUntrackedParameter("expectESValue")) {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment( + "This test EDLooper can consume arbitrary number of IntProduct's at Run, Lumi, and Event transitions. It " + "always consumes DummyData EventSetup product in beginRun and Event transitions. For all the consumed " + "products it requires the value of the product to correspond the value in configuratoin. It stops looping " + "after 3rd time."); + desc.addUntracked>("srcBeginRun", std::vector{}); + desc.addUntracked>("srcBeginLumi", std::vector{}); + desc.addUntracked>("srcEvent", std::vector{}); + desc.addUntracked>("srcEndLumi", std::vector{}); + desc.addUntracked>("srcEndRun", std::vector{}); + desc.addUntracked>("expectBeginRunValues", std::vector{}); + desc.addUntracked>("expectBeginLumiValues", std::vector{}); + desc.addUntracked>("expectEventValues", std::vector{}); + desc.addUntracked>("expectEndLumiValues", std::vector{}); + desc.addUntracked>("expectEndRunValues", std::vector{}); + desc.addUntracked("expectESValue"); + descriptions.addDefault(desc); + } + + void beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) override { + for (size_t i = 0; i < tokensBeginRun_.size(); ++i) { + int const expectedValue = valuesBeginRun_[i]; + int const value = iRun.get(tokensBeginRun_[i]).value; + if (expectedValue != value) { + throw cms::Exception("WrongValue") + << "expected value " << expectedValue << " but got " << value << " for beginRun product " << i; + } + } + + auto const& data = iSetup.getData(esTokenBeginRun_); + if (data.value_ != valueES_) { + throw cms::Exception("WrongValue") + << " expected value " << valueES_ << " but got " << data.value_ << " for EventSetup product in beginRun"; + } + } + + void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const&) override { + for (size_t i = 0; i < tokensBeginLumi_.size(); ++i) { + int const expectedValue = valuesBeginLumi_[i]; + int const value = iLumi.get(tokensBeginLumi_[i]).value; + if (expectedValue != value) { + throw cms::Exception("WrongValue") + << "expected value " << expectedValue << " but got " << value << " for beginLumi product " << i; + } + } + } + + void endLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const&) override { + for (size_t i = 0; i < tokensEndLumi_.size(); ++i) { + int const expectedValue = valuesEndLumi_[i]; + int const value = iLumi.get(tokensEndLumi_[i]).value; + if (expectedValue != value) { + throw cms::Exception("WrongValue") + << "expected value " << expectedValue << " but got " << value << " for endLumi product " << i; + } + } + } + + void endRun(edm::Run const& iRun, edm::EventSetup const&) override { + for (size_t i = 0; i < tokensEndRun_.size(); ++i) { + int const expectedValue = valuesEndRun_[i]; + int const value = iRun.get(tokensEndRun_[i]).value; + if (expectedValue != value) { + throw cms::Exception("WrongValue") + << "expected value " << expectedValue << " but got " << value << " for endRun product " << i; + } + } + } + + void startingNewLoop(unsigned int) override {} + + Status duringLoop(edm::Event const& iEvent, edm::EventSetup const& iSetup) override { + for (size_t i = 0; i < tokensEvent_.size(); ++i) { + int const expectedValue = valuesEvent_[i]; + int const value = iEvent.get(tokensEvent_[i]).value; + if (expectedValue != value) { + throw cms::Exception("WrongValue") + << "expected value " << expectedValue << " but got " << value << " for Event product " << i; + } + } + + auto const& data = iSetup.getData(esToken_); + if (data.value_ != valueES_) { + throw cms::Exception("WrongValue") + << " expected value " << valueES_ << " but got " << data.value_ << " for EventSetup product in duringLoop"; + } + + return kContinue; + } + + Status endOfLoop(edm::EventSetup const&, unsigned int iCount) override { return iCount == 2 ? kStop : kContinue; } + + private: + const std::vector> tokensBeginRun_; + const std::vector> tokensBeginLumi_; + const std::vector> tokensEvent_; + const std::vector> tokensEndLumi_; + const std::vector> tokensEndRun_; + edm::ESGetToken const esTokenBeginRun_; + edm::ESGetToken const esToken_; + const std::vector valuesBeginRun_; + const std::vector valuesBeginLumi_; + const std::vector valuesEvent_; + const std::vector valuesEndLumi_; + const std::vector valuesEndRun_; + const int valueES_; + }; +} // namespace edmtest + +using IntTestLooper = edmtest::IntTestLooper; +DEFINE_FWK_LOOPER(IntTestLooper); diff --git a/FWCore/Framework/test/stubs/TestModuleChangeLooper.cc b/FWCore/Framework/test/stubs/TestModuleChangeLooper.cc index 5b6d0871a79b8..2dccfff45fb7c 100644 --- a/FWCore/Framework/test/stubs/TestModuleChangeLooper.cc +++ b/FWCore/Framework/test/stubs/TestModuleChangeLooper.cc @@ -16,7 +16,6 @@ // // user include files -#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/TestObjects/interface/ToyProducts.h" #include "FWCore/Framework/interface/EDLooper.h" #include "FWCore/Framework/interface/Event.h" @@ -38,21 +37,24 @@ class TestModuleChangeLooper : public edm::EDLooper { void startingNewLoop(unsigned int) {} Status duringLoop(edm::Event const& iEvent, edm::EventSetup const&) { - edm::Handle handle; - iEvent.getByLabel(m_tag, handle); - if (handle->value != m_expectedValue) { - throw cms::Exception("WrongValue") << "expected value " << m_expectedValue << " but got " << handle->value; + auto const& product = iEvent.get(m_token); + if (product.value != m_expectedValue) { + throw cms::Exception("WrongValue") << "expected value " << m_expectedValue << " but got " << product.value; } return kContinue; } Status endOfLoop(edm::EventSetup const&, unsigned int iCount) { //modify the module - edm::ParameterSet const* pset = scheduleInfo()->parametersForModule(m_tag.label()); + Labels labels; + labelsForToken(m_token, labels); + std::string const moduleLabel{labels.module}; + + edm::ParameterSet const* pset = scheduleInfo()->parametersForModule(moduleLabel); assert(0 != pset); edm::ParameterSet newPSet(*pset); newPSet.addParameter("ivalue", ++m_expectedValue); - auto success = moduleChanger()->changeModule(m_tag.label(), newPSet); + auto success = moduleChanger()->changeModule(moduleLabel, newPSet); assert(success && "moduleChanger()->changeModule(m_tag.label(), newPSet)"); return iCount == 2 ? kStop : kContinue; @@ -61,7 +63,7 @@ class TestModuleChangeLooper : public edm::EDLooper { private: // ----------member data --------------------------- int m_expectedValue; - edm::InputTag m_tag; + edm::EDGetTokenT m_token; }; // @@ -77,7 +79,7 @@ class TestModuleChangeLooper : public edm::EDLooper { // TestModuleChangeLooper::TestModuleChangeLooper(edm::ParameterSet const& iConfig) : m_expectedValue(iConfig.getUntrackedParameter("startingValue")), - m_tag(iConfig.getUntrackedParameter("tag")) { + m_token(consumes(iConfig.getUntrackedParameter("tag"))) { //now do what ever other initialization is needed } diff --git a/FWCore/Framework/test/test_edlooper_consumes_cfg.py b/FWCore/Framework/test/test_edlooper_consumes_cfg.py new file mode 100644 index 0000000000000..9e3d695fe0509 --- /dev/null +++ b/FWCore/Framework/test/test_edlooper_consumes_cfg.py @@ -0,0 +1,29 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(5) +) + +process.source = cms.Source("EmptySource") + +process.intEventProducer = cms.EDProducer("IntProducer", + ivalue = cms.int32(42) +) + +process.essource = cms.ESSource("EmptyESSource", + recordName = cms.string('DummyRecord'), + iovIsRunNotTime = cms.bool(True), + firstValid = cms.vuint32(1) +) +process.add_(cms.ESProducer("LoadableDummyProvider", + value = cms.untracked.int32(5))) + +process.looper = cms.Looper("IntTestLooper", + srcEvent = cms.untracked.VInputTag("intEventProducer"), + expectEventValues = cms.untracked.vint32(42), + expectESValue = cms.untracked.int32(5) +) + +process.p1 = cms.Path(process.intEventProducer) diff --git a/FWCore/ParameterSet/python/Modules.py b/FWCore/ParameterSet/python/Modules.py index 3406889521de1..a1a03fe18c89d 100644 --- a/FWCore/ParameterSet/python/Modules.py +++ b/FWCore/ParameterSet/python/Modules.py @@ -700,7 +700,7 @@ def testSwithProducerWithAlias(self): foo = cms.VPSet(cms.PSet( type = cms.string('Foo2') )) -) + ) ) """) diff --git a/FWCore/ParameterSet/python/Types.py b/FWCore/ParameterSet/python/Types.py index 1ecf5ae15260b..3024376a009b4 100644 --- a/FWCore/ParameterSet/python/Types.py +++ b/FWCore/ParameterSet/python/Types.py @@ -1444,7 +1444,7 @@ def dumpPython(self, options=PrintOptions()): options.indent() resultList.append(options.indentation()+name+' = '+param.dumpPython(options)) options.unindent() - return '\n'.join(resultList)+'\n)' + return '\n'.join(resultList) + '\n' + options.indentation() + ')' # an EDAlias only references other modules by label, so it does not need their definition def directDependencies(self): diff --git a/GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.cc b/GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.cc new file mode 100644 index 0000000000000..d0eb9778881f5 --- /dev/null +++ b/GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.cc @@ -0,0 +1,202 @@ +#include "PythiaAllDauVFilter.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include +#include +#include + +using namespace edm; +using namespace std; +using namespace Pythia8; + +PythiaAllDauVFilter::PythiaAllDauVFilter(const edm::ParameterSet& iConfig) + : fVerbose(iConfig.getUntrackedParameter("verbose", 0)), + token_(consumes( + // edm::InputTag(iConfig.getUntrackedParameter("moduleLabel", std::string("generator")), "unsmeared"))), + edm::InputTag(iConfig.getUntrackedParameter("moduleLabel", std::string("generator"))))), + particleID(iConfig.getUntrackedParameter("ParticleID", 0)), + motherID(iConfig.getUntrackedParameter("MotherID", 0)), + chargeconju(iConfig.getUntrackedParameter("ChargeConjugation", true)), + ndaughters(iConfig.getUntrackedParameter("NumberDaughters", 0)), + maxptcut(iConfig.getUntrackedParameter("MaxPt", 14000.)) { + //now do what ever initialization is needed + vector defdauID; + defdauID.push_back(0); + dauIDs = iConfig.getUntrackedParameter >("DaughterIDs", defdauID); + vector defminptcut; + defminptcut.push_back(0.); + minptcut = iConfig.getUntrackedParameter >("MinPt", defminptcut); + vector defminetacut; + defminetacut.push_back(-10.); + minetacut = iConfig.getUntrackedParameter >("MinEta", defminetacut); + vector defmaxetacut; + defmaxetacut.push_back(10.); + maxetacut = iConfig.getUntrackedParameter >("MaxEta", defmaxetacut); + + // create pythia8 instance to access particle data + edm::LogInfo("PythiaAllDauVFilter") << "Creating pythia8 instance for particle properties" << endl; + if (!fLookupGen.get()) + fLookupGen = std::make_unique(); + + if (chargeconju) { + antiParticleID = -particleID; + if (!(fLookupGen->particleData.isParticle(antiParticleID))) + antiParticleID = particleID; + + int antiId; + for (size_t i = 0; i < dauIDs.size(); i++) { + antiId = -dauIDs[i]; + if (!(fLookupGen->particleData.isParticle(antiId))) + antiId = dauIDs[i]; + + antiDauIDs.push_back(antiId); + } + } + + edm::LogInfo("PythiaAllDauVFilter") << "----------------------------------------------------------------------" + << endl; + edm::LogInfo("PythiaAllDauVFilter") << "--- PythiaAllDauVFilter" << endl; + for (unsigned int i = 0; i < dauIDs.size(); ++i) { + edm::LogInfo("PythiaAllDauVFilter") << "ID: " << dauIDs[i] << " pT > " << minptcut[i] << " " << minetacut[i] + << " eta < " << maxetacut[i] << endl; + } + if (chargeconju) + for (unsigned int i = 0; i < antiDauIDs.size(); ++i) { + edm::LogInfo("PythiaAllDauVFilter") << "ID: " << antiDauIDs[i] << " pT > " << minptcut[i] << " " << minetacut[i] + << " eta < " << maxetacut[i] << endl; + } + edm::LogInfo("PythiaAllDauVFilter") << "maxptcut = " << maxptcut << endl; + edm::LogInfo("PythiaAllDauVFilter") << "particleID = " << particleID << endl; + if (chargeconju) + edm::LogInfo("PythiaAllDauVFilter") << "antiParticleID = " << antiParticleID << endl; + + edm::LogInfo("PythiaAllDauVFilter") << "motherID = " << motherID << endl; +} + +PythiaAllDauVFilter::~PythiaAllDauVFilter() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) +} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +bool PythiaAllDauVFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + using namespace edm; + bool accepted = false; + Handle evt; + iEvent.getByToken(token_, evt); + + int OK(1); + vector vparticles; + vector foundDaughter(dauIDs.size(), false); + auto dauCollection = &dauIDs; + + HepMC::GenEvent* myGenEvent = new HepMC::GenEvent(*(evt->GetEvent())); + + if (fVerbose > 5) { + edm::LogInfo("PythiaAllDauVFilter") << "looking for " << particleID << endl; + } + + for (HepMC::GenEvent::particle_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end(); ++p) { + if ((*p)->pdg_id() == particleID) { + dauCollection = &(dauIDs); + } else if (chargeconju and ((*p)->pdg_id() == antiParticleID)) { + dauCollection = &(antiDauIDs); + } else { + continue; + } + + // -- Check for mother of this particle + if (0 != motherID) { + OK = 0; + for (HepMC::GenVertex::particles_in_const_iterator des = (*p)->production_vertex()->particles_in_const_begin(); + des != (*p)->production_vertex()->particles_in_const_end(); + ++des) { + if (fVerbose > 10) { + edm::LogInfo("PythiaAllDauVFilter") << "mother: " << (*des)->pdg_id() << " pT: " << (*des)->momentum().perp() + << " eta: " << (*des)->momentum().eta() << endl; + } + if (abs(motherID) == abs((*des)->pdg_id())) { + OK = 1; + break; + } + } + } + if (0 == OK) + continue; + + // -- check for daugthers + int ndau = 0; + for (unsigned int i = 0; i < foundDaughter.size(); ++i) { + foundDaughter[i] = false; + } + if (fVerbose > 5) { + edm::LogInfo("PythiaAllDauVFilter") << "found ID: " << (*p)->pdg_id() << " pT: " << (*p)->momentum().perp() + << " eta: " << (*p)->momentum().eta() << endl; + } + if ((*p)->end_vertex()) { + for (HepMC::GenVertex::particle_iterator des = (*p)->end_vertex()->particles_begin(HepMC::children); + des != (*p)->end_vertex()->particles_end(HepMC::children); + ++des) { + ++ndau; + if (fVerbose > 5) { + edm::LogInfo("PythiaAllDauVFilter") + << "\t daughter : ID: " << (*des)->pdg_id() << " pT: " << (*des)->momentum().perp() + << " eta: " << (*des)->momentum().eta() << endl; + } + for (unsigned int i = 0; i < dauCollection->size(); ++i) { + if ((*des)->pdg_id() != dauCollection->at(i)) + continue; + + // possible to have more than one daughter of same pdgID and same/different kinematic constraints + if (foundDaughter[i]) + continue; + + if (fVerbose > 5) { + edm::LogInfo("PythiaAllDauVFilter") + << "\t\t checking cuts of , daughter i = " << i << " pT = " << (*des)->momentum().perp() + << " eta = " << (*des)->momentum().eta() << endl; + } + if ((*des)->momentum().perp() > minptcut[i] && (*des)->momentum().perp() < maxptcut && + (*des)->momentum().eta() > minetacut[i] && (*des)->momentum().eta() < maxetacut[i]) { + foundDaughter[i] = true; + vparticles.push_back((*des)->pdg_id()); + if (fVerbose > 2) { + edm::LogInfo("PythiaAllDauVFilter") + << "\t accepted this particle " << (*des)->pdg_id() << " pT = " << (*des)->momentum().perp() + << " eta = " << (*des)->momentum().eta() << endl; + } + break; + } + } + } + } + + // -- ( number of daughtrs == daughters passing cut ) and ( all daughters specified are found) + if (ndau == ndaughters) { + accepted = true; + for (unsigned int i = 0; i < foundDaughter.size(); ++i) { + if (!foundDaughter[i]) { + accepted = false; + } + } + if (accepted and (fVerbose > 0)) { + edm::LogInfo("PythiaAllDauVFilter") << " accepted this decay from " << (*p)->pdg_id(); + for (unsigned int iv = 0; iv < vparticles.size(); ++iv) + edm::LogInfo("PythiaAllDauVFilter") << vparticles[iv] << " "; + edm::LogInfo("PythiaAllDauVFilter") << " from mother = " << motherID << endl; + } + } + + if (accepted) + break; + } + + delete myGenEvent; + return accepted; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(PythiaAllDauVFilter); diff --git a/GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.h b/GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.h new file mode 100644 index 0000000000000..1e7fd9444296c --- /dev/null +++ b/GeneratorInterface/GenFilters/plugins/PythiaAllDauVFilter.h @@ -0,0 +1,67 @@ +#ifndef PYTHIAALLDAUVFILTER_h +#define PYTHIAALLDAUVFILTER_h +// -*- C++ -*- +// +// Package: PythiaAllDauVFilter +// Class: PythiaAllDauVFilter +// +/**\class PythiaAllDauVFilter PythiaAllDauVFilter.cc + + Description: Filter events using MotherId and ChildrenIds infos + Accepts if event has a specified Mother with only specified daughters and all of the daughters complies to respective pT and eta Cuts + + Implementation: + +*/ +// +// Original Author: Daniele Pedrini, PythiaDauVFilter +// Aravind T S , Updated and Modified to PythiaAllDauVFilter +// Created: Apr 29 2008 +// Apr 12 2021 +// +// + +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDFilter.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "Pythia8/Pythia.h" + +// +// class decleration +// +namespace edm { + class HepMCProduct; +} + +class PythiaAllDauVFilter : public edm::global::EDFilter<> { +public: + explicit PythiaAllDauVFilter(const edm::ParameterSet&); + ~PythiaAllDauVFilter() override; + + bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + +private: + const int fVerbose; + const edm::EDGetTokenT token_; + std::vector dauIDs, antiDauIDs; + const int particleID; + int antiParticleID; + const int motherID; + const bool chargeconju; + const int ndaughters; + std::vector minptcut; + const double maxptcut; + std::vector minetacut; + std::vector maxetacut; + std::unique_ptr fLookupGen; // this instance is for accessing particleData information +}; +#endif diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml index 350081a97ee46..cc2bab4bb54cc 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -212,7 +212,7 @@ - + @@ -313,8 +313,8 @@ - - + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml index 27df4d10c9cd2..bb2e45e4b3e34 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml @@ -212,7 +212,7 @@ - + @@ -313,8 +313,8 @@ - - + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml index 14f76d7bc2eea..20496701f30d4 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml @@ -212,7 +212,7 @@ - + @@ -313,8 +313,8 @@ - - + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml index 4fae7d8c6e643..6ae8d93134488 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml @@ -212,7 +212,7 @@ - + @@ -313,8 +313,8 @@ - - + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml index 8c3823c4c9e59..0ca6cfb407a5e 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml @@ -212,7 +212,7 @@ - + @@ -313,8 +313,8 @@ - - + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml index 2e9a1fd37418b..3d04e0f92ac0e 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml @@ -212,7 +212,7 @@ - + @@ -313,8 +313,8 @@ - - + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D80.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D80.xml index 191e51ba964e0..2ec682be52ca5 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D80.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D80.xml @@ -38,7 +38,6 @@ - diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D81.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D81.xml index 3ba8b48d3dc20..f31ed51b57523 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D81.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D81.xml @@ -38,7 +38,6 @@ - diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D82.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D82.xml new file mode 100644 index 0000000000000..a6605b56f6366 --- /dev/null +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D82.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D83.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D83.xml new file mode 100644 index 0000000000000..38fec4ef11f0f --- /dev/null +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D83.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D84.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D84.xml new file mode 100644 index 0000000000000..d72e2eca97afc --- /dev/null +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D84.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py index f6f2f6cf06d23..92eb58fd716a2 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py @@ -213,7 +213,7 @@ 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -316,8 +316,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py index a41a3051a90a6..58ff186d3fc77 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py @@ -213,7 +213,7 @@ 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -316,8 +316,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py index c8f975766fc33..05b78d14a696f 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py @@ -213,7 +213,7 @@ 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -316,8 +316,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py index ce736f4b9f258..01dc96413933c 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py @@ -213,7 +213,7 @@ 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -316,8 +316,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py index b727645b9079f..debfe8726e570 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -213,7 +213,7 @@ 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -316,8 +316,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py index 11876df440471..9c467908aae19 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py @@ -213,7 +213,7 @@ 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/eregalgo/2017/v1/eregalgo.xml', @@ -316,8 +316,8 @@ 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', 'Geometry/VeryForwardData/data/RP_Device.xml', - 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station/v1/CTPPS_220_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v1/CTPPS_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v1/CTPPS_210_Right_Station.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D80XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D80XML_cfi.py index 3c62f3b439999..079537091a988 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D80XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D80XML_cfi.py @@ -39,7 +39,6 @@ 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelsens.xml', 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/trackerRecoMaterial.xml', - 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D81XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D81XML_cfi.py index e54f9bf2cb626..f9d33dcd1d272 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D81XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D81XML_cfi.py @@ -39,7 +39,6 @@ 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelsens.xml', 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/trackerRecoMaterial.xml', - 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT702_2021_03/pixelProdCuts.xml', 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D82XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D82XML_cfi.py new file mode 100644 index 0000000000000..dae3745000696 --- /dev/null +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D82XML_cfi.py @@ -0,0 +1,137 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2026/v5/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2026/v5/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2026/v3/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', + 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', + 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/pixfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/pixbar.xml', + 'Geometry/TrackerCommonData/data/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/otst.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker800_2020_07/tracker.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker615/pixel.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerbar.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerStructureTopology.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker613/pixelStructureTopology.xml', + 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/trackersens.xml', + 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/pixelsens.xml', + 'Geometry/TrackerRecoData/data/PhaseII/OuterTracker616_2020_04/trackerRecoMaterial.xml', + 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII.xml', + 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/PhaseII/TiltedTracker404/pixelProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo/v1/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v14/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v14/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v14/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v14/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v14/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v13/hgcalConsData.xml', + 'Geometry/ForwardCommonData/data/hfnose/v4/hfnose.xml', + 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml', + 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnoseWafer.xml', + 'Geometry/ForwardCommonData/data/hfnoseLayer/v2/hfnoseLayer.xml', + 'Geometry/ForwardCommonData/data/hfnoseCons/v1m/hfnoseCons.xml', + 'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml', + 'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml', + 'Geometry/MuonCommonData/data/mb3/2015/v2/mb3.xml', + 'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml', + 'Geometry/MuonCommonData/data/mb4Shield/2021/v1/mb4Shield.xml', + 'Geometry/MuonCommonData/data/muonYoke/2026/v1/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf/2026/v7/mf.xml', + 'Geometry/MuonCommonData/data/csc/2021/v2/csc.xml', + 'Geometry/MuonCommonData/data/rpcf/2026/v3/rpcf.xml', + 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', + 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', + 'Geometry/MuonCommonData/data/gem21/TDR_Eta16/gem21.xml', + 'Geometry/MuonCommonData/data/mfshield/2026/v5/mfshield.xml', + 'Geometry/MuonCommonData/data/ge0/TDR_Dev/v3/ge0.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + 'Geometry/MTDCommonData/data/mtdMaterial/v2/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v1/btl.xml', + 'Geometry/MTDCommonData/data/etl/v5/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v3/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml', + )+ + cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/v3/muonNumbering.xml', + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2026/v5c/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv9.xml', + 'Geometry/ForwardSimData/data/hfnosesens.xml', + 'Geometry/MuonSimData/data/PhaseII/v2/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/2026/v1/RPCSpecs.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecsFilter.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecs.xml', + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + 'Geometry/MTDSimData/data/v2/mtdsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv9.xml', + 'Geometry/ForwardSimData/data/hfnoseProdCuts.xml', + 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/MTDSimData/data/v2/mtdProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ), + rootNodeName = cms.string('cms:OCMS') +) diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D83XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D83XML_cfi.py new file mode 100644 index 0000000000000..ad14785a5293f --- /dev/null +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D83XML_cfi.py @@ -0,0 +1,130 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2026/v5/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2026/v5/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2026/v3/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', + 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', + 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/pixbar.xml', + 'Geometry/TrackerCommonData/data/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/otst.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/tracker.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixel.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerbar.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerStructureTopology.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelStructureTopology.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelsens.xml', + 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerRecoMaterial.xml', + 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v15/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v15/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v15/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v15/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v15/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v15/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v15/hgcalConsData.xml', + 'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml', + 'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml', + 'Geometry/MuonCommonData/data/mb3/2015/v2/mb3.xml', + 'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml', + 'Geometry/MuonCommonData/data/mb4Shield/2021/v1/mb4Shield.xml', + 'Geometry/MuonCommonData/data/muonYoke/2026/v1/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf/2026/v7/mf.xml', + 'Geometry/MuonCommonData/data/csc/2021/v2/csc.xml', + 'Geometry/MuonCommonData/data/rpcf/2026/v3/rpcf.xml', + 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', + 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', + 'Geometry/MuonCommonData/data/gem21/TDR_Eta16/gem21.xml', + 'Geometry/MuonCommonData/data/mfshield/2026/v5/mfshield.xml', + 'Geometry/MuonCommonData/data/ge0/TDR_Dev/v3/ge0.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm/2026/v1/brm.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + 'Geometry/MTDCommonData/data/mtdMaterial/v2/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v1/btl.xml', + 'Geometry/MTDCommonData/data/etl/v5/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v3/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml', + )+ + cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/v3/muonNumbering.xml', + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2026/v2c/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv15.xml', + 'Geometry/MuonSimData/data/PhaseII/v2/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/2026/v1/RPCSpecs.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecsFilter.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecs.xml', + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + 'Geometry/MTDSimData/data/v2/mtdsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv15.xml', + 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/MTDSimData/data/v2/mtdProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ), + rootNodeName = cms.string('cms:OCMS') +) diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D84XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D84XML_cfi.py new file mode 100644 index 0000000000000..f08574ee41d55 --- /dev/null +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D84XML_cfi.py @@ -0,0 +1,130 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generate2026Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2026/v4/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2026/v5/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2026/v3/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', + 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', + 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/pixbar.xml', + 'Geometry/TrackerCommonData/data/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/otst.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/tracker.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixel.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerbar.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerStructureTopology.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelStructureTopology.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelsens.xml', + 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerRecoMaterial.xml', + 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v13/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v12/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v12/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v12/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v13/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v13/hgcalConsData.xml', + 'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml', + 'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml', + 'Geometry/MuonCommonData/data/mb3/2015/v2/mb3.xml', + 'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml', + 'Geometry/MuonCommonData/data/mb4Shield/2021/v1/mb4Shield.xml', + 'Geometry/MuonCommonData/data/muonYoke/2026/v1/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf/2026/v6/mf.xml', + 'Geometry/MuonCommonData/data/csc/2021/v2/csc.xml', + 'Geometry/MuonCommonData/data/rpcf/2026/v3/rpcf.xml', + 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', + 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', + 'Geometry/MuonCommonData/data/gem21/TDR_Dev/gem21.xml', + 'Geometry/MuonCommonData/data/mfshield/2026/v4/mfshield.xml', + 'Geometry/MuonCommonData/data/me0/TDR_Dev/v3/me0.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm/2026/v1/brm.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + 'Geometry/MTDCommonData/data/mtdMaterial/v1/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v1/btl.xml', + 'Geometry/MTDCommonData/data/etl/v3/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v1/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml', + )+ + cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/v1/muonNumbering.xml', + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2026/v2/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv9.xml', + 'Geometry/MuonSimData/data/PhaseII/ME0EtaPart/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/2026/v1/RPCSpecs.xml', + 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecsFilter.xml', + 'Geometry/GEMGeometryBuilder/data/v7/GEMSpecs.xml', + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + 'Geometry/MTDSimData/data/v1/mtdsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv9.xml', + 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/MTDSimData/data/v1/mtdProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ), + rootNodeName = cms.string('cms:OCMS') +) diff --git a/Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml b/Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml new file mode 100644 index 0000000000000..11e52a1e1b415 --- /dev/null +++ b/Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h b/Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h index 5e55a5bbcfd8f..c600cb5c29978 100644 --- a/Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h +++ b/Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h @@ -6,12 +6,16 @@ #define EcalBarrelNumberingScheme_h #include "Geometry/EcalCommonData/interface/EcalNumberingScheme.h" +#include class EcalBarrelNumberingScheme : public EcalNumberingScheme { public: EcalBarrelNumberingScheme(); ~EcalBarrelNumberingScheme() override; uint32_t getUnitID(const EcalBaseNumber& baseNumber) const override; + +private: + std::pair numbers(const std::string&) const; }; #endif diff --git a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgoSubtraction.cc b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgoSubtraction.cc new file mode 100644 index 0000000000000..3cfc703d6b3ea --- /dev/null +++ b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgoSubtraction.cc @@ -0,0 +1,3054 @@ +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" +#include "DataFormats/Math/interface/angle_units.h" +#include "DetectorDescription/DDCMS/interface/DDPlugins.h" +#include "DetectorDescription/DDCMS/interface/BenchmarkGrd.h" +#include "DetectorDescription/DDCMS/interface/DDutils.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Geometry/CaloGeometry/interface/EcalTrapezoidParameters.h" +#include "Math/AxisAngle.h" +#include "CLHEP/Geometry/Point3D.h" +#include "CLHEP/Geometry/Vector3D.h" +#include "CLHEP/Geometry/Transform3D.h" + +//#define EDM_ML_DEBUG + +using namespace std; +using namespace cms; +using namespace dd4hep; +using namespace angle_units::operators; + +using VecDouble = vector; +using VecStr = vector; +using EcalTrap = EcalTrapezoidParameters; + +using Pt3D = HepGeom::Point3D; +using Vec3 = CLHEP::Hep3Vector; +using Rota = CLHEP::HepRotation; +using Ro3D = HepGeom::Rotate3D; +using Tl3D = HepGeom::Translate3D; +using Tf3D = HepGeom::Transform3D; +using RoX3D = HepGeom::RotateX3D; +using RoZ3D = HepGeom::RotateZ3D; + +namespace { + + // Barrel volume + struct Barrel { + string name; // Barrel volume name + string mat; // Barrel material name + VecDouble vecZPts; // Barrel list of z pts + VecDouble vecRMin; // Barrel list of rMin pts + VecDouble vecRMax; // Barrel list of rMax pts + VecDouble vecTran; // Barrel translation + VecDouble vecRota; // Barrel rotation + VecDouble vecRota2; // 2nd Barrel rotation + VecDouble vecRota3; // 3nd Barrel rotation + double phiLo; // Barrel phi lo + double phiHi; // Barrel phi hi + double here; // Barrel presence flag + }; + + // Supermodule volume + struct Supermodule { + string name; // Supermodule volume name + string mat; // Supermodule material name + VecDouble vecZPts; // Supermodule list of z pts + VecDouble vecRMin; // Supermodule list of rMin pts + VecDouble vecRMax; // Supermodule list of rMax pts + VecDouble vecTran; // Supermodule translation + VecDouble vecRota; // Supermodule rotation + VecDouble vecBTran; // Base Supermodule translation + VecDouble vecBRota; // Base Supermodule rotation + unsigned int nPerHalf; // # Supermodules per half detector + double lowPhi; // Low phi value of base supermodule + double delPhi; // Delta phi value of base supermodule + double phiOff; // Phi offset value supermodule + VecDouble vecHere; // Bit saying if a supermodule is present or not + string cutName; // Name of cut box + double cutThick; // Box thickness + int cutShow; // Non-zero means show the box on display (testing only) + VecDouble vecCutTM; // Translation for minus phi cut box + VecDouble vecCutTP; // Translation for plus phi cut box + double cutRM; // Rotation for minus phi cut box + double cutRP; // Rotation for plus phi cut box + double expThick; // Thickness (x) of supermodule expansion box + double expWide; // Width (y) of supermodule expansion box + double expYOff; // Offset (y) of supermodule expansion box + string sideName; // Supermodule Side Plate volume name + string sideMat; // Supermodule Side Plate material name + double sideHigh; // Side plate height + double sideThick; // Side plate thickness + double sideYOffM; // Side plate Y offset on minus phi side + double sideYOffP; // Side plate Y offset on plus phi side + }; + + struct Crystal { + VecDouble vecNomCryDimBF; // Nominal crystal BF + VecDouble vecNomCryDimCF; // Nominal crystal CF + VecDouble vecNomCryDimAR; // Nominal crystal AR + VecDouble vecNomCryDimBR; // Nominal crystal BR + VecDouble vecNomCryDimCR; // Nominal crystal CR + double nomCryDimAF; // Nominal crystal AF + double nomCryDimLZ; // Nominal crystal LZ + + double underAF; // undershoot of AF + double underLZ; // undershoot of LZ + double underBF; // undershoot of BF + double underCF; // undershoot of CF + double underAR; // undershoot of AR + double underBR; // undershoot of BR + double underCR; // undershoot of CR + + string name; // string name of crystal volume + string clrName; // string name of clearance volume + string wrapName; // string name of wrap volume + string wallName; // string name of wall volume + + string mat; // string name of crystal material + string clrMat; // string name of clearance material + string wrapMat; // string name of wrap material + string wallMat; // string name of wall material + }; + + struct Alveolus { + double wallThAlv; // alveoli wall thickness + double wrapThAlv; // wrapping thickness + double clrThAlv; // clearance thickness (nominal) + VecDouble vecGapAlvEta; // Extra clearance after each alveoli perp to crystal axis + + double wallFrAlv; // alveoli wall frontage + double wrapFrAlv; // wrapping frontage + double clrFrAlv; // clearance frontage (nominal) + + double wallReAlv; // alveoli wall rearage + double wrapReAlv; // wrapping rearage + double clrReAlv; // clearance rearage (nominal) + + unsigned int nCryTypes; // number of crystal shapes + unsigned int nCryPerAlvEta; // number of crystals in eta per alveolus + }; + struct Capsule { + string name; // Capsule + double here; // + string mat; // + double xSizeHalf; // + double ySizeHalf; // + double thickHalf; // + }; + + struct Ceramic { + string name; // Ceramic + string mat; // + double xSizeHalf; // + double ySizeHalf; // + double thickHalf; // + }; + + struct BulkSilicon { + string name; // Bulk Silicon + string mat; // + double xSizeHalf; // + double ySizeHalf; // + double thickHalf; // + }; + + struct APD { + string name; // APD + string mat; // + double side; // + double thick; // + double z; // + double x1; // + double x2; // + + string atjName; // After-The-Junction + string atjMat; // + double atjThickHalf; // + + string sglName; // APD-Silicone glue + string sglMat; // + double sglThick; // + + string aglName; // APD-Glue + string aglMat; // + double aglThick; // + + string andName; // APD-Non-Depleted + string andMat; // + double andThick; // + }; + + struct Web { + double here; // here flag + string plName; // string name of web plate volume + string clrName; // string name of web clearance volume + string plMat; // string name of web material + string clrMat; // string name of web clearance material + VecDouble vecWebPlTh; // Thickness of web plates + VecDouble vecWebClrTh; // Thickness of total web clearance + VecDouble vecWebLength; // Length of web plate + }; + + struct InnerLayerVolume { + double here; // here flag + string name; // string name of inner layer volume + double phiLow; // low phi of volumes + double delPhi; // delta phi of ily + VecStr vecIlyMat; // materials of inner layer volumes + VecDouble vecIlyThick; // Thicknesses of inner layer volumes + + string pipeName; // Cooling pipes + double pipeHere; // + string pipeMat; // + double pipeODHalf; // + double pipeID; // + VecDouble vecIlyPipeLengthHalf; // + VecDouble vecIlyPipeType; // + VecDouble vecIlyPipePhi; // + VecDouble vecIlyPipeZ; // + + string pTMName; // PTM + double pTMHere; // + string pTMMat; // + double pTMWidthHalf; // + double pTMLengthHalf; // + double pTMHeightHalf; // + VecDouble vecIlyPTMZ; // + VecDouble vecIlyPTMPhi; // + + string fanOutName; // FanOut + double fanOutHere; // + string fanOutMat; // + double fanOutWidthHalf; // + double fanOutLengthHalf; // + double fanOutHeightHalf; // + VecDouble vecIlyFanOutZ; // + VecDouble vecIlyFanOutPhi; // + string diffName; // Diffuser + string diffMat; // + double diffOff; // + double diffLengthHalf; // + string bndlName; // Fiber bundle + string bndlMat; // + double bndlOff; // + double bndlLengthHalf; // + string fEMName; // FEM + string fEMMat; // + double fEMWidthHalf; // + double fEMLengthHalf; // + double fEMHeightHalf; // + VecDouble vecIlyFEMZ; // + VecDouble vecIlyFEMPhi; // + }; + + struct AlveolarWedge { + string hawRName; // string name of half-alveolar wedge + string fawName; // string name of full-alveolar wedge + double fawHere; // here flag + double hawRHBIG; // height at big end of half alveolar wedge + double hawRhsml; // height at small end of half alveolar wedge + double hawRCutY; // x dim of hawR cut box + double hawRCutZ; // y dim of hawR cut box + double hawRCutDelY; // y offset of hawR cut box from top of HAW + double hawYOffCry; // Y offset of crystal wrt HAW at front + unsigned int nFawPerSupm; // Number of Full Alv. Wedges per supermodule + double fawPhiOff; // Phi offset for FAW placement + double fawDelPhi; // Phi delta for FAW placement + double fawPhiRot; // Phi rotation of FAW about own axis prior to placement + double fawRadOff; // Radial offset for FAW placement + }; + + struct Grid { + double here; // here flag + string name; // Grid name + string mat; // Grid material + double thick; // Grid Thickness + }; + + struct Back { + double xOff; // + double yOff; // + double here; // here flag + string sideName; // Back Sides + double sideHere; // + double sideLength; // + double sideHeight; // + double sideWidth; // + double sideYOff1; // + double sideYOff2; // + double sideAngle; // + string sideMat; // + string plateName; // back plate + double plateHere; // + double plateLength; // + double plateThick; // + double plateWidth; // + string plateMat; // + string plate2Name; // back plate2 + double plate2Thick; // + string plate2Mat; // + }; + + struct Grille { + string name; // grille + double here; // + double thick; // + double width; // + double zSpace; // + string mat; // + VecDouble vecHeight; // + VecDouble vecZOff; // + + string edgeSlotName; // Slots in Grille + string edgeSlotMat; // + double edgeSlotHere; // + double edgeSlotHeight; // + double edgeSlotWidth; // + + string midSlotName; // Slots in Grille + string midSlotMat; // + double midSlotHere; // + double midSlotWidth; // + double midSlotXOff; // + VecDouble vecMidSlotHeight; // + }; + + struct BackPipe { + double here; // here flag + string name; // + VecDouble vecDiam; // pipes + VecDouble vecThick; // pipes + string mat; // + string waterMat; // + }; + + struct BackCooling { + VecStr vecName; // cooling circuits + double here; // here flag + double barHere; // here flag + double barWidth; // + double barHeight; // + string mat; + string barName; // cooling bar + double barThick; // + string barMat; + string barSSName; // cooling bar tubing + double barSSThick; // + string barSSMat; + string barWaName; // cooling bar water + double barWaThick; // + string barWaMat; + double vFEHere; // here flag + string vFEName; + string vFEMat; + string backVFEName; + string backVFEMat; + VecDouble vecBackVFELyrThick; // + VecStr vecBackVFELyrName; // + VecStr vecBackVFELyrMat; // + VecDouble vecBackCoolNSec; // + VecDouble vecBackCoolSecSep; // + VecDouble vecBackCoolNPerSec; // + }; + + struct BackMisc { + double here; // here flag + VecDouble vecThick; // misc materials + VecStr vecName; // + VecStr vecMat; // + double backCBStdSep; // + }; + + struct PatchPanel { + double here; // here flag + string name; // + VecDouble vecThick; // patch panel materials + VecStr vecNames; // + VecStr vecMat; // + }; + + struct BackCoolTank { + double here; // here flag + string name; // service tank + double width; // + double thick; // + string mat; // + string waName; // + double waWidth; // + string waMat; // + string backBracketName; // + double backBracketHeight; // + string backBracketMat; // + }; + + struct DryAirTube { + double here; // here flag + string name; // dry air tube + unsigned int mbCoolTubeNum; // + double innDiam; // + double outDiam; // + string mat; // + }; + + struct MBCoolTube { + double here; // here flag + string name; // mothr bd cooling tube + double innDiam; // + double outDiam; // + string mat; // + }; + + struct MBManif { + double here; // here flag + string name; //mother bd manif + double innDiam; // + double outDiam; // + string mat; // + }; + + struct MBLyr { + double here; // here flag + VecDouble vecMBLyrThick; // mother bd lyrs + VecStr vecMBLyrName; // + VecStr vecMBLyrMat; // + }; + + struct Pincer { + double rodHere; // here flag + string rodName; // pincer rod + string rodMat; // + VecDouble vecRodAzimuth; // + + string envName; // pincer envelope + string envMat; // + double envWidthHalf; // + double envHeightHalf; // + double envLengthHalf; // + VecDouble vecEnvZOff; // + + string blkName; // pincer block + string blkMat; // + double blkLengthHalf; // + + string shim1Name; // pincer shim + double shimHeight; // + string shim2Name; // + string shimMat; // + double shim1Width; // + double shim2Width; // + + string cutName; // pincer block + string cutMat; // + double cutWidth; // + double cutHeight; // + }; + + const Rotation3D& myrot(cms::DDNamespace& ns, const string& nam, const CLHEP::HepRotation& r) { + ns.addRotation(nam, Rotation3D(r.xx(), r.xy(), r.xz(), r.yx(), r.yy(), r.yz(), r.zx(), r.zy(), r.zz())); + return ns.rotation(ns.prepend(nam)); + } + + Solid mytrap(const std::string& nam, const EcalTrapezoidParameters& t) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << nam << " Trap " << convertRadToDeg(t.theta()) << ":" << convertRadToDeg(t.phi()) + << ":" << cms::convert2mm(t.h1()) << ":" << cms::convert2mm(t.bl1()) << ":" + << cms::convert2mm(t.tl1()) << ":" << convertRadToDeg(t.alp1()) << ":" + << cms::convert2mm(t.h2()) << ":" << cms::convert2mm(t.bl2()) << ":" + << cms::convert2mm(t.tl2()) << ":" << convertRadToDeg(t.alp2()); +#endif + return Trap( + nam, t.dz(), t.theta(), t.phi(), t.h1(), t.bl1(), t.tl1(), t.alp1(), t.h2(), t.bl2(), t.tl2(), t.alp2()); + } + + string_view mynamespace(string_view input) { + string_view v = input; + auto trim_pos = v.find(':'); + if (trim_pos != v.npos) + v.remove_suffix(v.size() - (trim_pos + 1)); + return v; + } +} // namespace + +static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) { + BenchmarkGrd counter("DDEcalBarrelNewAlgo"); + cms::DDNamespace ns(ctxt, e, true); + cms::DDAlgoArguments args(ctxt, e); + + // TRICK! + string myns{mynamespace(args.parentName()).data(), mynamespace(args.parentName()).size()}; + + // Barrel volume + // barrel parent volume + Barrel bar; + bar.name = myns + args.str("BarName"); // Barrel volume name + bar.mat = args.str("BarMat"); // Barrel material name + bar.vecZPts = args.vecDble("BarZPts"); // Barrel list of z pts + bar.vecRMin = args.vecDble("BarRMin"); // Barrel list of rMin pts + bar.vecRMax = args.vecDble("BarRMax"); // Barrel list of rMax pts + bar.vecTran = args.vecDble("BarTran"); // Barrel translation + bar.vecRota = args.vecDble("BarRota"); // Barrel rotation + bar.vecRota2 = args.vecDble("BarRota2"); // 2nd Barrel rotation + bar.vecRota3 = args.vecDble("BarRota3"); // 3rd Barrel rotation + bar.phiLo = args.dble("BarPhiLo"); // Barrel phi lo + bar.phiHi = args.dble("BarPhiHi"); // Barrel phi hi + bar.here = args.dble("BarHere"); // Barrel presence flag + + // Supermodule volume + Supermodule spm; + spm.name = ns.prepend(args.str("SpmName")); // Supermodule volume name + spm.mat = args.str("SpmMat"); // Supermodule material name + spm.vecZPts = args.vecDble("SpmZPts"); // Supermodule list of z pts + spm.vecRMin = args.vecDble("SpmRMin"); // Supermodule list of rMin pts + spm.vecRMax = args.vecDble("SpmRMax"); // Supermodule list of rMax pts + spm.vecTran = args.vecDble("SpmTran"); // Supermodule translation + spm.vecRota = args.vecDble("SpmRota"); // Supermodule rotation + spm.vecBTran = args.vecDble("SpmBTran"); // Base Supermodule translation + spm.vecBRota = args.vecDble("SpmBRota"); // Base Supermodule rotation + spm.nPerHalf = args.integer("SpmNPerHalf"); // # Supermodules per half detector + spm.lowPhi = args.dble("SpmLowPhi"); // Low phi value of base supermodule + spm.delPhi = args.dble("SpmDelPhi"); // Delta phi value of base supermodule + spm.phiOff = args.dble("SpmPhiOff"); // Phi offset value supermodule + spm.vecHere = args.vecDble("SpmHere"); // Bit saying if a supermodule is present or not + spm.cutName = ns.prepend(args.str("SpmCutName")); // Name of cut box + spm.cutThick = args.dble("SpmCutThick"); // Box thickness + spm.cutShow = args.value("SpmCutShow"); // Non-zero means show the box on display (testing only) + spm.vecCutTM = args.vecDble("SpmCutTM"); // Translation for minus phi cut box + spm.vecCutTP = args.vecDble("SpmCutTP"); // Translation for plus phi cut box + spm.cutRM = args.dble("SpmCutRM"); // Rotation for minus phi cut box + spm.cutRP = args.dble("SpmCutRP"); // Rotation for plus phi cut box + spm.expThick = args.dble("SpmExpThick"); // Thickness (x) of supermodule expansion box + spm.expWide = args.dble("SpmExpWide"); // Width (y) of supermodule expansion box + spm.expYOff = args.dble("SpmExpYOff"); // Offset (y) of supermodule expansion box + spm.sideName = myns + args.str("SpmSideName"); // Supermodule Side Plate volume name + spm.sideMat = args.str("SpmSideMat"); // Supermodule Side Plate material name + spm.sideHigh = args.dble("SpmSideHigh"); // Side plate height + spm.sideThick = args.dble("SpmSideThick"); // Side plate thickness + spm.sideYOffM = args.dble("SpmSideYOffM"); // Side plate Y offset on minus phi side + spm.sideYOffP = args.dble("SpmSideYOffP"); // Side plate Y offset on plus phi side + + Crystal cry; + cry.nomCryDimAF = args.dble("NomCryDimAF"); + cry.nomCryDimLZ = args.dble("NomCryDimLZ"); + cry.vecNomCryDimBF = args.vecDble("NomCryDimBF"); + cry.vecNomCryDimCF = args.vecDble("NomCryDimCF"); + cry.vecNomCryDimAR = args.vecDble("NomCryDimAR"); + cry.vecNomCryDimBR = args.vecDble("NomCryDimBR"); + cry.vecNomCryDimCR = args.vecDble("NomCryDimCR"); + + cry.underAF = args.dble("UnderAF"); + cry.underLZ = args.dble("UnderLZ"); + cry.underBF = args.dble("UnderBF"); + cry.underCF = args.dble("UnderCF"); + cry.underAR = args.dble("UnderAR"); + cry.underBR = args.dble("UnderBR"); + cry.underCR = args.dble("UnderCR"); + + Alveolus alv; + alv.wallThAlv = args.dble("WallThAlv"); + alv.wrapThAlv = args.dble("WrapThAlv"); + alv.clrThAlv = args.dble("ClrThAlv"); + alv.vecGapAlvEta = args.vecDble("GapAlvEta"); + + alv.wallFrAlv = args.dble("WallFrAlv"); + alv.wrapFrAlv = args.dble("WrapFrAlv"); + alv.clrFrAlv = args.dble("ClrFrAlv"); + + alv.wallReAlv = args.dble("WallReAlv"); + alv.wrapReAlv = args.dble("WrapReAlv"); + alv.clrReAlv = args.dble("ClrReAlv"); + + alv.nCryTypes = args.integer("NCryTypes"); + alv.nCryPerAlvEta = args.integer("NCryPerAlvEta"); + + cry.name = ns.prepend(args.str("CryName")); + cry.clrName = ns.prepend(args.str("ClrName")); + cry.wrapName = ns.prepend(args.str("WrapName")); + cry.wallName = ns.prepend(args.str("WallName")); + + cry.mat = args.str("CryMat"); + cry.clrMat = args.str("ClrMat"); + cry.wrapMat = args.str("WrapMat"); + cry.wallMat = args.str("WallMat"); + + Capsule cap; + cap.name = ns.prepend(args.str("CapName")); + cap.here = args.dble("CapHere"); + cap.mat = args.str("CapMat"); + cap.xSizeHalf = 0.5 * args.dble("CapXSize"); + cap.ySizeHalf = 0.5 * args.dble("CapYSize"); + cap.thickHalf = 0.5 * args.dble("CapThick"); + + Ceramic cer; + cer.name = ns.prepend(args.str("CerName")); + cer.mat = args.str("CerMat"); + cer.xSizeHalf = 0.5 * args.dble("CerXSize"); + cer.ySizeHalf = 0.5 * args.dble("CerYSize"); + cer.thickHalf = 0.5 * args.dble("CerThick"); + + BulkSilicon bSi; + bSi.name = ns.prepend(args.str("BSiName")); + bSi.mat = args.str("BSiMat"); + bSi.xSizeHalf = 0.5 * args.dble("BSiXSize"); + bSi.ySizeHalf = 0.5 * args.dble("BSiYSize"); + bSi.thickHalf = 0.5 * args.dble("BSiThick"); + + APD apd; + apd.name = ns.prepend(args.str("APDName")); + apd.mat = args.str("APDMat"); + apd.side = args.dble("APDSide"); + apd.thick = args.dble("APDThick"); + apd.z = args.dble("APDZ"); + apd.x1 = args.dble("APDX1"); + apd.x2 = args.dble("APDX2"); + + apd.atjName = ns.prepend(args.str("ATJName")); + apd.atjMat = args.str("ATJMat"); + apd.atjThickHalf = 0.5 * args.dble("ATJThick"); + + apd.sglName = ns.prepend(args.str("SGLName")); + apd.sglMat = args.str("SGLMat"); + apd.sglThick = args.dble("SGLThick"); + + apd.aglName = ns.prepend(args.str("AGLName")); + apd.aglMat = args.str("AGLMat"); + apd.aglThick = args.dble("AGLThick"); + + apd.andName = ns.prepend(args.str("ANDName")); + apd.andMat = args.str("ANDMat"); + apd.andThick = args.dble("ANDThick"); + + Web web; + web.here = args.dble("WebHere"); + web.plName = ns.prepend(args.str("WebPlName")); + web.clrName = ns.prepend(args.str("WebClrName")); + web.plMat = args.str("WebPlMat"); + web.clrMat = args.str("WebClrMat"); + web.vecWebPlTh = args.vecDble("WebPlTh"); + web.vecWebClrTh = args.vecDble("WebClrTh"); + web.vecWebLength = args.vecDble("WebLength"); + + InnerLayerVolume ily; + ily.here = args.dble("IlyHere"); + ily.name = myns + args.str("IlyName"); + ily.phiLow = args.dble("IlyPhiLow"); + ily.delPhi = args.dble("IlyDelPhi"); + ily.vecIlyMat = args.vecStr("IlyMat"); + ily.vecIlyThick = args.vecDble("IlyThick"); + + ily.pipeName = myns + args.str("IlyPipeName"); + ily.pipeHere = args.dble("IlyPipeHere"); + ily.pipeMat = args.str("IlyPipeMat"); + ily.pipeODHalf = 0.5 * args.dble("IlyPipeOD"); + ily.pipeID = args.dble("IlyPipeID"); + ily.vecIlyPipeLengthHalf = args.vecDble("IlyPipeLength"); + std::transform(ily.vecIlyPipeLengthHalf.begin(), + ily.vecIlyPipeLengthHalf.end(), + ily.vecIlyPipeLengthHalf.begin(), + [](double length) -> double { return 0.5 * length; }); + + ily.vecIlyPipeType = args.vecDble("IlyPipeType"); + ily.vecIlyPipePhi = args.vecDble("IlyPipePhi"); + ily.vecIlyPipeZ = args.vecDble("IlyPipeZ"); + + ily.pTMName = myns + args.str("IlyPTMName"); + ily.pTMHere = args.dble("IlyPTMHere"); + ily.pTMMat = args.str("IlyPTMMat"); + ily.pTMWidthHalf = 0.5 * args.dble("IlyPTMWidth"); + ily.pTMLengthHalf = 0.5 * args.dble("IlyPTMLength"); + ily.pTMHeightHalf = 0.5 * args.dble("IlyPTMHeight"); + ily.vecIlyPTMZ = args.vecDble("IlyPTMZ"); + ily.vecIlyPTMPhi = args.vecDble("IlyPTMPhi"); + + ily.fanOutName = myns + args.str("IlyFanOutName"); + ily.fanOutHere = args.dble("IlyFanOutHere"); + ily.fanOutMat = args.str("IlyFanOutMat"); + ily.fanOutWidthHalf = 0.5 * args.dble("IlyFanOutWidth"); + ily.fanOutLengthHalf = 0.5 * args.dble("IlyFanOutLength"); + ily.fanOutHeightHalf = 0.5 * args.dble("IlyFanOutHeight"); + ily.vecIlyFanOutZ = args.vecDble("IlyFanOutZ"); + ily.vecIlyFanOutPhi = args.vecDble("IlyFanOutPhi"); + ily.diffName = myns + args.str("IlyDiffName"); + ily.diffMat = args.str("IlyDiffMat"); + ily.diffOff = args.dble("IlyDiffOff"); + ily.diffLengthHalf = 0.5 * args.dble("IlyDiffLength"); + ily.bndlName = myns + args.str("IlyBndlName"); + ily.bndlMat = args.str("IlyBndlMat"); + ily.bndlOff = args.dble("IlyBndlOff"); + ily.bndlLengthHalf = 0.5 * args.dble("IlyBndlLength"); + ily.fEMName = myns + args.str("IlyFEMName"); + ily.fEMMat = args.str("IlyFEMMat"); + ily.fEMWidthHalf = 0.5 * args.dble("IlyFEMWidth"); + ily.fEMLengthHalf = 0.5 * args.dble("IlyFEMLength"); + ily.fEMHeightHalf = 0.5 * args.dble("IlyFEMHeight"); + ily.vecIlyFEMZ = args.vecDble("IlyFEMZ"); + ily.vecIlyFEMPhi = args.vecDble("IlyFEMPhi"); + + AlveolarWedge alvWedge; + alvWedge.hawRName = myns + args.str("HawRName"); + alvWedge.fawName = myns + args.str("FawName"); + alvWedge.fawHere = args.dble("FawHere"); + alvWedge.hawRHBIG = args.dble("HawRHBIG"); + alvWedge.hawRhsml = args.dble("HawRhsml"); + alvWedge.hawRCutY = args.dble("HawRCutY"); + alvWedge.hawRCutZ = args.dble("HawRCutZ"); + alvWedge.hawRCutDelY = args.dble("HawRCutDelY"); + alvWedge.hawYOffCry = args.dble("HawYOffCry"); + + alvWedge.nFawPerSupm = args.integer("NFawPerSupm"); + alvWedge.fawPhiOff = args.dble("FawPhiOff"); + alvWedge.fawDelPhi = args.dble("FawDelPhi"); + alvWedge.fawPhiRot = args.dble("FawPhiRot"); + alvWedge.fawRadOff = args.dble("FawRadOff"); + + Grid grid; + grid.here = args.dble("GridHere"); + grid.name = myns + args.str("GridName"); + grid.mat = args.str("GridMat"); + grid.thick = args.dble("GridThick"); + + Back back; + back.here = args.dble("BackHere"); + back.xOff = args.dble("BackXOff"); + back.yOff = args.dble("BackYOff"); + back.sideName = myns + args.str("BackSideName"); + back.sideHere = args.dble("BackSideHere"); + back.sideLength = args.dble("BackSideLength"); + back.sideHeight = args.dble("BackSideHeight"); + back.sideWidth = args.dble("BackSideWidth"); + back.sideYOff1 = args.dble("BackSideYOff1"); + back.sideYOff2 = args.dble("BackSideYOff2"); + back.sideAngle = args.dble("BackSideAngle"); + back.sideMat = args.str("BackSideMat"); + back.plateName = myns + args.str("BackPlateName"); + back.plateHere = args.dble("BackPlateHere"); + back.plateLength = args.dble("BackPlateLength"); + back.plateThick = args.dble("BackPlateThick"); + back.plateWidth = args.dble("BackPlateWidth"); + back.plateMat = args.str("BackPlateMat"); + back.plate2Name = myns + args.str("BackPlate2Name"); + back.plate2Thick = args.dble("BackPlate2Thick"); + back.plate2Mat = args.str("BackPlate2Mat"); + + Grille grille; + grille.name = myns + args.str("GrilleName"); + grille.here = args.dble("GrilleHere"); + grille.thick = args.dble("GrilleThick"); + grille.width = args.dble("GrilleWidth"); + grille.zSpace = args.dble("GrilleZSpace"); + grille.mat = args.str("GrilleMat"); + grille.vecHeight = args.vecDble("GrilleHeight"); + grille.vecZOff = args.vecDble("GrilleZOff"); + + grille.edgeSlotName = myns + args.str("GrEdgeSlotName"); + grille.edgeSlotMat = args.str("GrEdgeSlotMat"); + grille.edgeSlotHere = args.dble("GrEdgeSlotHere"); + grille.edgeSlotHeight = args.dble("GrEdgeSlotHeight"); + grille.edgeSlotWidth = args.dble("GrEdgeSlotWidth"); + grille.midSlotName = myns + args.str("GrMidSlotName"); + grille.midSlotMat = args.str("GrMidSlotMat"); + grille.midSlotHere = args.dble("GrMidSlotHere"); + grille.midSlotWidth = args.dble("GrMidSlotWidth"); + grille.midSlotXOff = args.dble("GrMidSlotXOff"); + grille.vecMidSlotHeight = args.vecDble("GrMidSlotHeight"); + + BackPipe backPipe; + backPipe.here = args.dble("BackPipeHere"); + backPipe.name = myns + args.str("BackPipeName"); + backPipe.vecDiam = args.vecDble("BackPipeDiam"); + backPipe.vecThick = args.vecDble("BackPipeThick"); + backPipe.mat = args.str("BackPipeMat"); + backPipe.waterMat = args.str("BackPipeWaterMat"); + + BackCooling backCool; + backCool.here = args.dble("BackCoolHere"); + backCool.vecName = args.vecStr("BackCoolName"); + std::transform(backCool.vecName.begin(), + backCool.vecName.end(), + backCool.vecName.begin(), + [&myns](std::string name) -> std::string { return (myns + name); }); + backCool.barHere = args.dble("BackCoolBarHere"); + backCool.barWidth = args.dble("BackCoolBarWidth"); + backCool.barHeight = args.dble("BackCoolBarHeight"); + backCool.mat = args.str("BackCoolMat"); + backCool.barName = myns + args.str("BackCoolBarName"); + backCool.barThick = args.dble("BackCoolBarThick"); + backCool.barMat = args.str("BackCoolBarMat"); + backCool.barSSName = myns + args.str("BackCoolBarSSName"); + backCool.barSSThick = args.dble("BackCoolBarSSThick"); + backCool.barSSMat = args.str("BackCoolBarSSMat"); + backCool.barWaName = myns + args.str("BackCoolBarWaName"); + backCool.barWaThick = args.dble("BackCoolBarWaThick"); + backCool.barWaMat = args.str("BackCoolBarWaMat"); + backCool.vFEHere = args.dble("BackCoolVFEHere"); + backCool.vFEName = myns + args.str("BackCoolVFEName"); + backCool.vFEMat = args.str("BackCoolVFEMat"); + backCool.backVFEName = args.str("BackVFEName"); + backCool.backVFEMat = args.str("BackVFEMat"); + backCool.vecBackVFELyrThick = args.vecDble("BackVFELyrThick"); + backCool.vecBackVFELyrName = args.vecStr("BackVFELyrName"); + std::transform(backCool.vecBackVFELyrName.begin(), + backCool.vecBackVFELyrName.end(), + backCool.vecBackVFELyrName.begin(), + [&myns](std::string name) -> std::string { return (myns + name); }); + backCool.vecBackVFELyrMat = args.vecStr("BackVFELyrMat"); + backCool.vecBackCoolNSec = args.vecDble("BackCoolNSec"); + backCool.vecBackCoolSecSep = args.vecDble("BackCoolSecSep"); + backCool.vecBackCoolNPerSec = args.vecDble("BackCoolNPerSec"); + + BackMisc backMisc; + backMisc.here = args.dble("BackMiscHere"); + backMisc.vecThick = args.vecDble("BackMiscThick"); + backMisc.vecName = args.vecStr("BackMiscName"); + std::transform(backMisc.vecName.begin(), + backMisc.vecName.end(), + backMisc.vecName.begin(), + [&myns](std::string name) -> std::string { return (myns + name); }); + backMisc.vecMat = args.vecStr("BackMiscMat"); + backMisc.backCBStdSep = args.dble("BackCBStdSep"); + + PatchPanel patchPanel; + patchPanel.here = args.dble("PatchPanelHere"); + patchPanel.vecThick = args.vecDble("PatchPanelThick"); + patchPanel.vecNames = args.vecStr("PatchPanelNames"); + std::transform(patchPanel.vecNames.begin(), + patchPanel.vecNames.end(), + patchPanel.vecNames.begin(), + [&myns](std::string name) -> std::string { return (myns + name); }); + + patchPanel.vecMat = args.vecStr("PatchPanelMat"); + patchPanel.name = myns + args.str("PatchPanelName"); + + BackCoolTank backCoolTank; + backCoolTank.here = args.dble("BackCoolTankHere"); + backCoolTank.name = myns + args.str("BackCoolTankName"); + backCoolTank.width = args.dble("BackCoolTankWidth"); + backCoolTank.thick = args.dble("BackCoolTankThick"); + backCoolTank.mat = args.str("BackCoolTankMat"); + backCoolTank.waName = myns + args.str("BackCoolTankWaName"); + backCoolTank.waWidth = args.dble("BackCoolTankWaWidth"); + backCoolTank.waMat = args.str("BackCoolTankWaMat"); + backCoolTank.backBracketName = myns + args.str("BackBracketName"); + backCoolTank.backBracketHeight = args.dble("BackBracketHeight"); + backCoolTank.backBracketMat = args.str("BackBracketMat"); + + DryAirTube dryAirTube; + dryAirTube.here = args.dble("DryAirTubeHere"); + dryAirTube.name = args.str("DryAirTubeName"); + dryAirTube.mbCoolTubeNum = args.integer("MBCoolTubeNum"); + dryAirTube.innDiam = args.dble("DryAirTubeInnDiam"); + dryAirTube.outDiam = args.dble("DryAirTubeOutDiam"); + dryAirTube.mat = args.str("DryAirTubeMat"); + + MBCoolTube mbCoolTube; + mbCoolTube.here = args.dble("MBCoolTubeHere"); + mbCoolTube.name = myns + args.str("MBCoolTubeName"); + mbCoolTube.innDiam = args.dble("MBCoolTubeInnDiam"); + mbCoolTube.outDiam = args.dble("MBCoolTubeOutDiam"); + mbCoolTube.mat = args.str("MBCoolTubeMat"); + + MBManif mbManif; + mbManif.here = args.dble("MBManifHere"); + mbManif.name = myns + args.str("MBManifName"); + mbManif.innDiam = args.dble("MBManifInnDiam"); + mbManif.outDiam = args.dble("MBManifOutDiam"); + mbManif.mat = args.str("MBManifMat"); + + MBLyr mbLyr; + mbLyr.here = args.dble("MBLyrHere"); + mbLyr.vecMBLyrThick = args.vecDble("MBLyrThick"); + mbLyr.vecMBLyrName = args.vecStr("MBLyrName"); + std::transform(mbLyr.vecMBLyrName.begin(), + mbLyr.vecMBLyrName.end(), + mbLyr.vecMBLyrName.begin(), + [&myns](std::string name) -> std::string { return (myns + name); }); + mbLyr.vecMBLyrMat = args.vecStr("MBLyrMat"); + + Pincer pincer; + pincer.rodHere = args.dble("PincerRodHere"); + pincer.rodName = myns + args.str("PincerRodName"); + pincer.rodMat = args.str("PincerRodMat"); + pincer.vecRodAzimuth = args.vecDble("PincerRodAzimuth"); + pincer.envName = myns + args.str("PincerEnvName"); + pincer.envMat = args.str("PincerEnvMat"); + pincer.envWidthHalf = 0.5 * args.dble("PincerEnvWidth"); + pincer.envHeightHalf = 0.5 * args.dble("PincerEnvHeight"); + pincer.envLengthHalf = 0.5 * args.dble("PincerEnvLength"); + pincer.vecEnvZOff = args.vecDble("PincerEnvZOff"); + pincer.blkName = myns + args.str("PincerBlkName"); + pincer.blkMat = args.str("PincerBlkMat"); + pincer.blkLengthHalf = 0.5 * args.dble("PincerBlkLength"); + pincer.shim1Name = myns + args.str("PincerShim1Name"); + pincer.shimHeight = args.dble("PincerShimHeight"); + pincer.shim2Name = myns + args.str("PincerShim2Name"); + pincer.shimMat = args.str("PincerShimMat"); + pincer.shim1Width = args.dble("PincerShim1Width"); + pincer.shim2Width = args.dble("PincerShim2Width"); + pincer.cutName = myns + args.str("PincerCutName"); + pincer.cutMat = args.str("PincerCutMat"); + pincer.cutWidth = args.dble("PincerCutWidth"); + pincer.cutHeight = args.dble("PincerCutHeight"); + + Volume parentVolume = ns.volume(args.parentName()); + if (bar.here != 0) { + const unsigned int copyOne(1); + const unsigned int copyTwo(2); + // Barrel parent volume---------------------------------------------------------- + Solid barSolid = Polycone(bar.name, bar.phiLo, (bar.phiHi - bar.phiLo), bar.vecRMin, bar.vecRMax, bar.vecZPts); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << bar.name << " PolyCone from " << convertRadToDeg(bar.phiLo) << " to " + << convertRadToDeg(bar.phiHi) << " with " << bar.vecZPts.size() << " points"; + for (unsigned int k = 0; k < bar.vecZPts.size(); ++k) + edm::LogVerbatim("EBGeom") << "[" << k << "] " << cms::convert2mm(bar.vecZPts[k]) << ":" + << cms::convert2mm(bar.vecRMin[k]) << ":" << cms::convert2mm(bar.vecRMax[k]); +#endif + Position tran(bar.vecTran[0], bar.vecTran[1], bar.vecTran[2]); + Rotation3D rotation = myrot(ns, + bar.name + "Rot", + Rota(Vec3(bar.vecRota3[0], bar.vecRota3[1], bar.vecRota3[2]), bar.vecRota3[3]) * + Rota(Vec3(bar.vecRota2[0], bar.vecRota2[1], bar.vecRota2[2]), bar.vecRota2[3]) * + Rota(Vec3(bar.vecRota[0], bar.vecRota[1], bar.vecRota[2]), bar.vecRota[3])); + Volume barVolume = Volume(bar.name, barSolid, ns.material(bar.mat)); + parentVolume.placeVolume(barVolume, copyOne, Transform3D(rotation, tran)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << barVolume.name() << ":" << copyOne << " positioned in " << parentVolume.name() + << " at (" << cms::convert2mm(tran.x()) << "," << cms::convert2mm(tran.y()) << "," + << cms::convert2mm(tran.z()) << ") with rotation"; +#endif + // End Barrel parent volume---------------------------------------------------------- + + // Supermodule parent------------------------------------------------------------ + + const string spmcut1ddname((0 != spm.cutShow) ? spm.name : (spm.name + "CUT1")); + Solid ddspm = Polycone(spmcut1ddname, spm.lowPhi, spm.delPhi, spm.vecRMin, spm.vecRMax, spm.vecZPts); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << spmcut1ddname << " PolyCone from " << convertRadToDeg(spm.lowPhi) << " to " + << convertRadToDeg(spm.lowPhi + spm.delPhi) << " with " << spm.vecZPts.size() + << " points"; + for (unsigned int k = 0; k < spm.vecZPts.size(); ++k) + edm::LogVerbatim("EBGeom") << "[" << k << "] " << cms::convert2mm(spm.vecZPts[k]) << ":" + << cms::convert2mm(spm.vecRMin[k]) << ":" << cms::convert2mm(spm.vecRMax[k]); +#endif + + const unsigned int indx(0.5 * spm.vecRMax.size()); + + // Deal with the cut boxes first + array cutBoxParms{{1.05 * (spm.vecRMax[indx] - spm.vecRMin[indx]) * 0.5, + 0.5 * spm.cutThick, + fabs(spm.vecZPts.back() - spm.vecZPts.front()) * 0.5 + 1.0 * dd4hep::mm}}; + Solid spmCutBox = Box(spm.cutName, cutBoxParms[0], cutBoxParms[1], cutBoxParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << spm.cutName << " Box " << cms::convert2mm(cutBoxParms[0]) << ":" + << cms::convert2mm(cutBoxParms[1]) << ":" << cms::convert2mm(cutBoxParms[2]); + +#endif + Volume spmCutLog = Volume(spm.cutName, spmCutBox, ns.material(spm.mat)); + + // Supermodule side platess + array sideParms{{0.5 * spm.sideHigh, 0.5 * spm.sideThick, 0.5 * fabs(spm.vecZPts[1] - spm.vecZPts[0])}}; + Solid sideSolid = Box(spm.sideName, sideParms[0], sideParms[1], sideParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << spm.sideName << " Box " << cms::convert2mm(sideParms[0]) << ":" + << cms::convert2mm(sideParms[1]) << ":" << cms::convert2mm(sideParms[2]); +#endif + Volume sideLog = Volume(spm.sideName, sideSolid, ns.material(spm.sideMat)); + + Solid temp1; + Solid temp2; + Position sideddtra1; + Position sideddtra2; + Transform3D alltrot1; + Transform3D alltrot2; + for (unsigned int icopy(1); icopy <= 2; ++icopy) { + const std::vector& tvec(1 == icopy ? spm.vecCutTM : spm.vecCutTP); + double rang(1 == icopy ? spm.cutRM : spm.cutRP); + + const Position tr(tvec[0], tvec[1], tvec[2]); + RotationZ ro(rang); + const double ang(1 == icopy ? spm.lowPhi : spm.lowPhi + spm.delPhi); + RotationZ ro1(ang); + const Position tr1( + 0.5 * (spm.vecRMax[indx] + spm.vecRMin[indx]), 0, 0.5 * (spm.vecZPts.front() + spm.vecZPts.back())); + Transform3D alltrot(Transform3D(Transform3D(ro1 * tr1) * tr) * ro); + if (1 == icopy) { + alltrot1 = alltrot; + temp1 = SubtractionSolid(spm.name + "_T1", ddspm, spmCutBox, alltrot); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << (spm.name + "_T1") << " Subtraction " << ddspm.name() << ":" << spmCutBox.name() + << " at (" << cms::convert2mm(alltrot.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; +#endif + } else { + alltrot2 = alltrot; + temp2 = SubtractionSolid(spm.name, temp1, spmCutBox, alltrot); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << spm.name << " Subtraction " << temp1.name() << ":" << spmCutBox.name() << " at (" + << cms::convert2mm(alltrot.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; +#endif + } + const Tl3D trSide(tvec[0], + tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) + + (1 == icopy ? spm.sideYOffM : spm.sideYOffP), + tvec[2]); + const RoZ3D roSide(rang); + const Tf3D sideRot(RoZ3D(1 == icopy ? spm.lowPhi : spm.lowPhi + spm.delPhi) * + Tl3D(spm.vecRMin.front() + sideParms[0], 0, spm.vecZPts.front() + sideParms[2]) * trSide * + roSide); + + Rotation3D sideddrot(myrot(ns, spm.sideName + std::to_string(icopy), sideRot.getRotation())); + const Position sideddtra(sideRot.getTranslation()); + 1 == icopy ? sideddtra1 = sideddtra : sideddtra2 = sideddtra; + } + Volume spmLog = Volume(spm.name, ((0 != spm.cutShow) ? ddspm : temp2), ns.material(spm.mat)); + if (0 != spm.cutShow) { + spmLog.placeVolume(spmCutLog, 1, alltrot1); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" + << cms::convert2mm(alltrot1.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot1.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot1.Translation().Vect().z()) << ") with rotation"; +#endif + spmLog.placeVolume(spmCutLog, 1, alltrot2); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" + << cms::convert2mm(alltrot2.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot2.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot2.Translation().Vect().z()) << ") with rotation"; +#endif + } + spmLog.placeVolume(sideLog, 1, Transform3D(ns.rotation(spm.sideName + std::to_string(1)), sideddtra1)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << sideLog.name() << ":1 positioned in " << spmLog.name() << " at (" + << cms::convert2mm(sideddtra1.x()) << "," << cms::convert2mm(sideddtra1.y()) << "," + << cms::convert2mm(sideddtra1.z()) << ") with rotation"; +#endif + spmLog.placeVolume(sideLog, 2, Transform3D(ns.rotation(spm.sideName + std::to_string(2)), sideddtra2)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << sideLog.name() << ":2 positioned in " << spmLog.name() << " at (" + << cms::convert2mm(sideddtra2.x()) << "," << cms::convert2mm(sideddtra2.y()) << "," + << cms::convert2mm(sideddtra2.z()) << ") with rotation"; +#endif + + const double dphi(360._deg / (1. * spm.nPerHalf)); + for (unsigned int iphi(0); iphi < 2 * spm.nPerHalf; ++iphi) { + const double phi(iphi * dphi + spm.phiOff); + + // this base rotation includes the base translation & rotation + // plus flipping for the negative z hemisphere, plus + // the phi rotation for this module + const Tf3D rotaBase(RoZ3D(phi) * (iphi < spm.nPerHalf ? Ro3D() : RoX3D(180._deg)) * + Ro3D(spm.vecBRota[3], Vec3(spm.vecBRota[0], spm.vecBRota[1], spm.vecBRota[2])) * + Tl3D(Vec3(spm.vecBTran[0], spm.vecBTran[1], spm.vecBTran[2]))); + + // here the individual rotations & translations of the supermodule + // are implemented on top of the overall "base" rotation & translation + + const unsigned int offr(4 * iphi); + const unsigned int offt(3 * iphi); + + const Ro3D r1(spm.vecRota[offr + 3], Vec3(spm.vecRota[offr + 0], spm.vecRota[offr + 1], spm.vecRota[offr + 2])); + + const Tf3D rotaExtra(r1 * Tl3D(Vec3(spm.vecTran[offt + 0], spm.vecTran[offt + 1], spm.vecTran[offt + 2]))); + + const Tf3D both(rotaExtra * rotaBase); + + const Rotation3D rota(myrot(ns, spm.name + std::to_string(convertRadToDeg(phi)), both.getRotation())); + + if (spm.vecHere[iphi] != 0) { + // convert from CLHEP to Position & etc. + Position myTran(both.getTranslation().x(), both.getTranslation().y(), both.getTranslation().z()); + barVolume.placeVolume(spmLog, iphi + 1, Transform3D(rota, myTran)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << spmLog.name() << ":" << (iphi + 1) << " positioned in " << barVolume.name() + << " at (" << cms::convert2mm(myTran.x()) << "," << cms::convert2mm(myTran.y()) + << "," << cms::convert2mm(myTran.z()) << ") with rotation"; +#endif + } + } + // End Supermodule parent------------------------------------------------------------ + + // Begin Inner Layer volumes--------------------------------------------------------- + const double ilyLengthHalf(0.5 * (spm.vecZPts[1] - spm.vecZPts[0])); + double ilyRMin(spm.vecRMin[0]); + double ilyThick(0); + for (unsigned int ilyx(0); ilyx != ily.vecIlyThick.size(); ++ilyx) { + ilyThick += ily.vecIlyThick[ilyx]; + } + Solid ilySolid = Tube(ily.name, + ilyRMin, // rmin + ilyRMin + ilyThick, // rmax + ilyLengthHalf, // dz + ily.phiLow, // startPhi + ily.phiLow + ily.delPhi); // startPhi + deltaPhi +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << ily.name << " Tubs " << cms::convert2mm(ilyLengthHalf) << ":" + << cms::convert2mm(ilyRMin) << ":" << cms::convert2mm(ilyRMin + ilyThick) << ":" + << convertRadToDeg(ily.phiLow) << ":" << convertRadToDeg(ily.delPhi); +#endif + Volume ilyLog = Volume(ily.name, ilySolid, ns.material(spm.mat)); + spmLog.placeVolume(ilyLog, copyOne, Position(0, 0, ilyLengthHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << ilyLog.name() << ":" << copyOne << " positioned in " << spmLog.name() << " at (0,0," + << cms::convert2mm(ilyLengthHalf) << ") with no rotation"; +#endif + Volume ilyPipeLog[200]; + if (0 != ily.pipeHere) { + for (unsigned int iPipeType(0); iPipeType != ily.vecIlyPipeLengthHalf.size(); ++iPipeType) { + string pName(ily.pipeName + "_" + std::to_string(iPipeType + 1)); + + Solid ilyPipeSolid = Tube(pName, + 0, // rmin + ily.pipeODHalf, // rmax + ily.vecIlyPipeLengthHalf[iPipeType], // dz + 0_deg, // startPhi + 360_deg); // startPhi + deltaPhi +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pName << " Tubs " << cms::convert2mm(ily.vecIlyPipeLengthHalf[iPipeType]) + << ":0:" << cms::convert2mm(ily.pipeODHalf) << ":0:360"; +#endif + ilyPipeLog[iPipeType] = Volume(pName, ilyPipeSolid, ns.material(ily.pipeMat)); + + string pWaName(ily.pipeName + "Wa_" + std::to_string(iPipeType + 1)); + Solid ilyPipeWaSolid = Tube(pWaName, + 0, // rmin + 0.5 * ily.pipeID, // rmax + ily.vecIlyPipeLengthHalf[iPipeType], // dz + 0_deg, // startPhi + 360_deg); // startPhi + deltaPhi +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pWaName << " Tubs " << cms::convert2mm(ily.vecIlyPipeLengthHalf[iPipeType]) + << ":0:" << cms::convert2mm(0.5 * ily.pipeID) << ":0:360"; +#endif + Volume ilyPipeWaLog = Volume(pWaName, ilyPipeWaSolid, ns.material(backPipe.waterMat)); + ilyPipeLog[iPipeType].placeVolume(ilyPipeWaLog, copyOne); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << ilyPipeWaLog.name() << ":" << copyOne << " positioned in " + << ilyPipeLog[iPipeType].name() << " at (0,0,0) with no rotation"; +#endif + } + } + + Solid ilyPTMSolid = Box(ily.pTMName, ily.pTMHeightHalf, ily.pTMWidthHalf, ily.pTMLengthHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << ily.pTMName << " Box " << cms::convert2mm(ily.pTMHeightHalf) << ":" + << cms::convert2mm(ily.pTMWidthHalf) << ":" << cms::convert2mm(ily.pTMLengthHalf); +#endif + Volume ilyPTMLog = Volume(ily.pTMName, ilyPTMSolid, ns.material(ily.pTMMat)); + + Solid ilyFanOutSolid = Box(ily.fanOutName, ily.fanOutHeightHalf, ily.fanOutWidthHalf, ily.fanOutLengthHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << ily.fanOutName << " Box " << cms::convert2mm(ily.fanOutHeightHalf) << ":" + << cms::convert2mm(ily.fanOutWidthHalf) << ":" << cms::convert2mm(ily.fanOutLengthHalf); +#endif + Volume ilyFanOutLog = Volume(ily.fanOutName, ilyFanOutSolid, ns.material(ily.fanOutMat)); + + Solid ilyFEMSolid = Box(ily.fEMName, ily.fEMHeightHalf, ily.fEMWidthHalf, ily.fEMLengthHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << ily.fEMName << " Box " << cms::convert2mm(ily.fEMHeightHalf) << ":" + << cms::convert2mm(ily.fEMWidthHalf) << ":" << cms::convert2mm(ily.fEMLengthHalf); +#endif + Volume ilyFEMLog = Volume(ily.fEMName, ilyFEMSolid, ns.material(ily.fEMMat)); + + Solid ilyDiffSolid = Box(ily.diffName, ily.fanOutHeightHalf, ily.fanOutWidthHalf, ily.diffLengthHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << ily.diffName << " Box " << cms::convert2mm(ily.fanOutHeightHalf) << ":" + << cms::convert2mm(ily.fanOutWidthHalf) << ":" << cms::convert2mm(ily.diffLengthHalf); +#endif + Volume ilyDiffLog = Volume(ily.diffName, ilyDiffSolid, ns.material(ily.diffMat)); + + Solid ilyBndlSolid = Box(ily.bndlName, ily.fanOutHeightHalf, ily.fanOutWidthHalf, ily.bndlLengthHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << ily.bndlName << " Box " << cms::convert2mm(ily.fanOutHeightHalf) << ":" + << cms::convert2mm(ily.fanOutWidthHalf) << ":" << cms::convert2mm(ily.bndlLengthHalf); +#endif + Volume ilyBndlLog = Volume(ily.bndlName, ilyBndlSolid, ns.material(ily.bndlMat)); + + ilyFanOutLog.placeVolume( + ilyDiffLog, copyOne, Position(0, 0, -ily.fanOutLengthHalf + ily.diffLengthHalf + ily.diffOff)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << ilyDiffLog.name() << ":" << copyOne << " positioned in " << ilyFanOutLog.name() + << " at (0,0," + << cms::convert2mm(-ily.fanOutLengthHalf + ily.diffLengthHalf + ily.diffOff) + << ") with no rotation"; +#endif + ilyFanOutLog.placeVolume( + ilyBndlLog, copyOne, Position(0, 0, -ily.fanOutLengthHalf + ily.bndlLengthHalf + ily.bndlOff)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << ilyBndlLog.name() << ":" << copyOne << " positioned in " << ilyFanOutLog.name() + << " at (0,0," + << cms::convert2mm(-ily.fanOutLengthHalf + ily.bndlLengthHalf + ily.bndlOff) + << ") with no rotation"; +#endif + + Volume xilyLog; + for (unsigned int iily(0); iily != ily.vecIlyThick.size(); ++iily) { + const double ilyRMax(ilyRMin + ily.vecIlyThick[iily]); + string xilyName(ily.name + std::to_string(iily)); + Solid xilySolid = Tube(xilyName, ilyRMin, ilyRMax, ilyLengthHalf, ily.phiLow, ily.phiLow + ily.delPhi); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << xilyName << " Tubs " << cms::convert2mm(ilyLengthHalf) << ":" + << cms::convert2mm(ilyRMin) << ":" << cms::convert2mm(ilyRMax) << ":" + << convertRadToDeg(ily.phiLow) << ":" << convertRadToDeg(ily.delPhi); +#endif + xilyLog = ns.addVolume(Volume(xilyName, xilySolid, ns.material(ily.vecIlyMat[iily]))); + if (0 != ily.here) { + ilyLog.placeVolume(xilyLog, copyOne); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << xilyLog.name() << ":" << copyOne << " positioned in " << ilyLog.name() + << " at (0,0,0) with no rotation"; +#endif + unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + if (10 * dd4hep::mm < ily.vecIlyThick[iily] && ily.vecIlyThick.size() != (iily + 1) && 0 != ily.pipeHere) { + if (0 != ily.pTMHere) { + unsigned int ptmCopy(0); + for (unsigned int ilyPTM(0); ilyPTM != ily.vecIlyPTMZ.size(); ++ilyPTM) { + const double radius(ilyRMax - 1 * dd4hep::mm - ily.pTMHeightHalf); + const double phi(ily.vecIlyPTMPhi[ilyPTM]); + const double yy(radius * sin(phi)); + const double xx(radius * cos(phi)); + ++ptmCopy; + xilyLog.placeVolume( + ilyPTMLog, + ptmCopy, + Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyPTMZ[ilyPTM] - ilyLengthHalf))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") + << ilyPTMLog.name() << ":" << ptmCopy << " positioned in " << xilyLog.name() << " at (" + << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << "," + << cms::convert2mm(ily.vecIlyPTMZ[ilyPTM] - ilyLengthHalf) << ") with rotation"; +#endif + } + } + if (0 != ily.fanOutHere) { + unsigned int fanOutCopy(0); + for (unsigned int ilyFO(0); ilyFO != ily.vecIlyFanOutZ.size(); ++ilyFO) { + const double radius(ilyRMax - 1 * dd4hep::mm - ily.fanOutHeightHalf); + const double phi(ily.vecIlyFanOutPhi[ilyFO]); + const double yy(radius * sin(phi)); + const double xx(radius * cos(phi)); + ++fanOutCopy; + xilyLog.placeVolume(ilyFanOutLog, + fanOutCopy, + Transform3D(RotationZ(phi) * RotationY(180_deg), + Position(xx, yy, ily.vecIlyFanOutZ[ilyFO] - ilyLengthHalf))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") + << ilyFanOutLog.name() << ":" << fanOutCopy << " positioned in " << xilyLog.name() << " at (" + << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << "," + << cms::convert2mm(ily.vecIlyFanOutZ[ilyFO] - ilyLengthHalf) << ") with rotation"; +#endif + } + unsigned int femCopy(0); + for (unsigned int ilyFEM(0); ilyFEM != ily.vecIlyFEMZ.size(); ++ilyFEM) { + const double radius(ilyRMax - 1 * dd4hep::mm - ily.fEMHeightHalf); + const double phi(ily.vecIlyFEMPhi[ilyFEM]); + const double yy(radius * sin(phi)); + const double xx(radius * cos(phi)); + ++femCopy; + xilyLog.placeVolume( + ilyFEMLog, + femCopy, + Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyFEMZ[ilyFEM] - ilyLengthHalf))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") + << ilyFEMLog.name() << ":" << femCopy << " positioned in " << xilyLog.name() << " at (" + << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << "," + << cms::convert2mm(ily.vecIlyFEMZ[ilyFEM] - ilyLengthHalf) << ") with rotation"; +#endif + } + } + for (unsigned int iPipe(0); iPipe != ily.vecIlyPipePhi.size(); ++iPipe) { + const unsigned int type(static_cast(round(ily.vecIlyPipeType[iPipe]))); + const double zz(-ilyLengthHalf + ily.vecIlyPipeZ[iPipe] + (9 > type ? ily.vecIlyPipeLengthHalf[type] : 0)); + + for (unsigned int ly(0); ly != 2; ++ly) { + const double radius(0 == ly ? ilyRMin + ily.pipeODHalf + 1 * dd4hep::mm + : ilyRMax - ily.pipeODHalf - 1 * dd4hep::mm); + const double phi(ily.vecIlyPipePhi[iPipe]); + const double yy(radius * sin(phi)); + const double xx(radius * cos(phi)); + ++copyNum[type]; + if (9 > type) { + xilyLog.placeVolume(ilyPipeLog[type], copyNum[type], Position(xx, yy, zz)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") + << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in " << xilyLog.name() << " at (" + << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << "," << cms::convert2mm(zz) + << ") with no rotation"; +#endif + } else { + xilyLog.placeVolume( + ilyPipeLog[type], + copyNum[type], + Transform3D(Rotation3D(ROOT::Math::AxisAngle(ROOT::Math::AxisAngle::XYZVector(xx, yy, 0), 90_deg)), + Position(xx, yy, zz))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in " + << xilyLog.name() << " at (" << cms::convert2mm(xx) << "," + << cms::convert2mm(yy) << "," << cms::convert2mm(zz) << ") with rotation"; +#endif + } + } + } + } + } + ilyRMin = ilyRMax; + } + // End Inner Layer volumes--------------------------------------------------------- + + string clyrName(ns.prepend("ECLYR")); + std::vector cri; + std::vector cro; + std::vector czz; + czz.emplace_back(spm.vecZPts[1]); + cri.emplace_back(spm.vecRMin[0]); + cro.emplace_back(spm.vecRMin[0] + 25 * dd4hep::mm); + czz.emplace_back(spm.vecZPts[2]); + cri.emplace_back(spm.vecRMin[2]); + cro.emplace_back(spm.vecRMin[2] + 10 * dd4hep::mm); + Solid clyrSolid = Polycone(clyrName, -9.5_deg, 19_deg, cri, cro, czz); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << clyrName << " PolyCone from -9.5 to 9.5 with " << czz.size() << " points"; + for (unsigned int k = 0; k < czz.size(); ++k) + edm::LogVerbatim("EBGeom") << "[" << k << "] " << cms::convert2mm(czz[k]) << ":" << cms::convert2mm(cri[k]) << ":" + << cms::convert2mm(cro[k]); +#endif + Volume clyrLog = Volume(clyrName, clyrSolid, ns.material(ily.vecIlyMat[4])); + spmLog.placeVolume(clyrLog, copyOne); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << clyrLog.name() << ":" << copyOne << " positioned in " << spmLog.name() + << " at (0,0,0) with no rotation"; +#endif + // Begin Alveolar Wedge parent ------------------------------------------------------ + //---------------- + + // the next few lines accumulate dimensions appropriate to crystal type 1 + // which we use to set some of the features of the half-alveolar wedge (hawR). + + const double BNom1(cry.vecNomCryDimCR[0]); + const double bNom1(cry.vecNomCryDimCF[0]); + const double sWall1(alv.wallThAlv); + const double fWall1(alv.wallFrAlv); + const double sWrap1(alv.wrapThAlv); + const double fWrap1(alv.wrapFrAlv); + const double sClr1(alv.clrThAlv); + const double fClr1(alv.clrFrAlv); + const double LNom1(cry.nomCryDimLZ); + const double beta1(atan((BNom1 - bNom1) / LNom1)); + const double sinbeta1(sin(beta1)); + + const double tana_hawR((BNom1 - bNom1) / LNom1); + + const double H_hawR(alvWedge.hawRHBIG); + const double h_hawR(alvWedge.hawRhsml); + const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1)); + const double B_hawR(a_hawR + H_hawR * tana_hawR); + const double b_hawR(a_hawR + h_hawR * tana_hawR); + const double L_hawR(spm.vecZPts[2]); + + const EcalTrap trapHAWR(0.5 * a_hawR, //double aHalfLengthXNegZLoY , // bl1, A/2 + 0.5 * a_hawR, //double aHalfLengthXPosZLoY , // bl2, a/2 + 0.5 * b_hawR, //double aHalfLengthXPosZHiY , // tl2, b/2 + 0.5 * H_hawR, //double aHalfLengthYNegZ , // h1, H/2 + 0.5 * h_hawR, //double aHalfLengthYPosZ , // h2, h/2 + 0.5 * L_hawR, //double aHalfLengthZ , // dz, L/2 + 90_deg, //double aAngleAD , // alfa1 + 0, //double aCoord15X , // x15 + 0 //double aCoord15Y // y15 + ); + + string hawRName1(alvWedge.hawRName + "1"); + Solid hawRSolid1 = mytrap(hawRName1, trapHAWR); + + const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) + M_PI_2); + + // here is trap for Full Alveolar Wedge + const EcalTrap trapFAW(a_hawR, //double aHalfLengthXNegZLoY , // bl1, A/2 + a_hawR, //double aHalfLengthXPosZLoY , // bl2, a/2 + b_hawR, //double aHalfLengthXPosZHiY , // tl2, b/2 + 0.5 * H_hawR, //double aHalfLengthYNegZ , // h1, H/2 + 0.5 * h_hawR, //double aHalfLengthYPosZ , // h2, h/2 + 0.5 * L_hawR, //double aHalfLengthZ , // dz, L/2 + al1_fawR, //double aAngleAD , // alfa1 + 0, //double aCoord15X , // x15 + 0 //double aCoord15Y // y15 + ); + + const string fawName1(alvWedge.fawName + "1"); + Solid fawSolid1 = mytrap(fawName1, trapFAW); + + const EcalTrap::VertexList vHAW(trapHAWR.vertexList()); + const EcalTrap::VertexList vFAW(trapFAW.vertexList()); + + const double hawBoxClr(1 * dd4hep::mm); + + // HAW cut box to cut off back end of wedge + const string hawCutName(alvWedge.hawRName + "CUTBOX"); + array hawBoxParms{{0.5 * b_hawR + hawBoxClr, 0.5 * alvWedge.hawRCutY, 0.5 * alvWedge.hawRCutZ}}; + Solid hawCutBox = Box(hawCutName, hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << hawCutName << " Box " << cms::convert2mm(hawBoxParms[0]) << ":" + << cms::convert2mm(hawBoxParms[1]) << ":" << cms::convert2mm(hawBoxParms[2]); +#endif + + const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]); + const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]); + const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]); + + const double zDel( + sqrt(4 * hawBoxParms[2] * hawBoxParms[2] - (h_hawR - alvWedge.hawRCutDelY) * (h_hawR - alvWedge.hawRCutDelY))); + + const Tf3D hawCutForm(b1, + b2, + b3, + vHAW[2] + Pt3D(hawBoxClr, -alvWedge.hawRCutDelY, 0), + vHAW[1] + Pt3D(-hawBoxClr, -alvWedge.hawRCutDelY, 0), + Pt3D(vHAW[0].x() - hawBoxClr, vHAW[0].y(), vHAW[0].z() - zDel)); + + Solid hawRSolid = SubtractionSolid(hawRSolid1, + hawCutBox, + Transform3D(myrot(ns, hawCutName + "R", hawCutForm.getRotation()), + Position(hawCutForm.getTranslation().x(), + hawCutForm.getTranslation().y(), + hawCutForm.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << alvWedge.hawRName << " Subtraction " << hawRSolid1.name() << ":" << hawCutBox.name() + << " at (" << cms::convert2mm(hawCutForm.getTranslation().x()) << "," + << cms::convert2mm(hawCutForm.getTranslation().y()) << "," + << cms::convert2mm(hawCutForm.getTranslation().z()) << ")"; +#endif + Volume hawRLog = Volume(alvWedge.hawRName, hawRSolid, ns.material(spm.mat)); + + // FAW cut box to cut off back end of wedge + const string fawCutName(alvWedge.fawName + "CUTBOX"); + const array fawBoxParms{{2 * hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]}}; + Solid fawCutBox = Box(fawCutName, fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << fawCutName << " Box " << cms::convert2mm(fawBoxParms[0]) << ":" + << cms::convert2mm(fawBoxParms[1]) << ":" << cms::convert2mm(fawBoxParms[2]); +#endif + + const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]); + const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]); + const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]); + + const Tf3D fawCutForm(bb1, + bb2, + bb3, + vFAW[2] + Pt3D(2 * hawBoxClr, -5 * dd4hep::mm, 0), + vFAW[1] + Pt3D(-2 * hawBoxClr, -5 * dd4hep::mm, 0), + Pt3D(vFAW[1].x() - 2 * hawBoxClr, vFAW[1].y() - trapFAW.h(), vFAW[1].z() - zDel)); + + Solid fawSolid = SubtractionSolid(fawSolid1, + fawCutBox, + Transform3D(myrot(ns, fawCutName + "R", fawCutForm.getRotation()), + Position(fawCutForm.getTranslation().x(), + fawCutForm.getTranslation().y(), + fawCutForm.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << alvWedge.fawName << " Subtraction " << fawSolid1.name() << ":" << fawCutBox.name() + << " at (" << cms::convert2mm(fawCutForm.getTranslation().x()) << "," + << cms::convert2mm(fawCutForm.getTranslation().y()) << "," + << cms::convert2mm(fawCutForm.getTranslation().z()) << ")"; +#endif + Volume fawLog = Volume(alvWedge.fawName, fawSolid, ns.material(spm.mat)); + + const Tf3D hawRform(vHAW[3], + vHAW[0], + vHAW[1], // HAW inside FAW + vFAW[3], + 0.5 * (vFAW[0] + vFAW[3]), + 0.5 * (vFAW[1] + vFAW[2])); + + fawLog.placeVolume( + hawRLog, + copyOne, + Transform3D( + myrot(ns, alvWedge.hawRName + "R", hawRform.getRotation()), + Position(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << hawRLog.name() << ":" << copyOne << " positioned in " << fawLog.name() << " at (" + << cms::convert2mm(hawRform.getTranslation().x()) << "," + << cms::convert2mm(hawRform.getTranslation().y()) << "," + << cms::convert2mm(hawRform.getTranslation().z()) << ") with rotation"; +#endif + + fawLog.placeVolume( + hawRLog, + copyTwo, + Transform3D( + Rotation3D(1., 0., 0., 0., 1., 0., 0., 0., -1.) * RotationY(M_PI), // rotate about Y after refl thru Z + Position(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << hawRLog.name() << ":" << copyTwo << " positioned in " << fawLog.name() << " at (" + << cms::convert2mm(-hawRform.getTranslation().x()) << "," + << cms::convert2mm(-hawRform.getTranslation().y()) << "," + << cms::convert2mm(-hawRform.getTranslation().z()) << ") with rotation"; +#endif + for (unsigned int iPhi(1); iPhi <= alvWedge.nFawPerSupm; ++iPhi) { + const double rPhi(alvWedge.fawPhiOff + (iPhi - 0.5) * alvWedge.fawDelPhi); + + const Tf3D fawform(RoZ3D(rPhi) * + Tl3D(alvWedge.fawRadOff + (trapFAW.H() + trapFAW.h()) / 4, 0, 0.5 * trapFAW.L()) * + RoZ3D(-90_deg + alvWedge.fawPhiRot)); + if (alvWedge.fawHere) { + spmLog.placeVolume( + fawLog, + iPhi, + Transform3D( + myrot(ns, alvWedge.fawName + "_Rot" + std::to_string(iPhi), fawform.getRotation()), + Position(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << fawLog.name() << ":" << iPhi << " positioned in " << spmLog.name() << " at (" + << cms::convert2mm(fawform.getTranslation().x()) << "," + << cms::convert2mm(fawform.getTranslation().y()) << "," + << cms::convert2mm(fawform.getTranslation().z()) << ") with rotation"; +#endif + } + } + + // End Alveolar Wedge parent ------------------------------------------------------ + + // Begin Grid + Tablet insertion + + const double h_Grid(grid.thick); + + const EcalTrap trapGrid(0.5 * (B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR), // bl1, A/2 + 0.5 * (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR), // bl2, a/2 + 0.5 * b_hawR, // tl2, b/2 + 0.5 * h_Grid, // h1, H/2 + 0.5 * h_Grid, // h2, h/2 + 0.5 * (L_hawR - 8 * dd4hep::cm), // dz, L/2 + 90_deg, // alfa1 + 0, // x15 + H_hawR - h_hawR // y15 + ); + + Solid gridSolid = mytrap(grid.name, trapGrid); + Volume gridLog = Volume(grid.name, gridSolid, ns.material(grid.mat)); + + const EcalTrap::VertexList vGrid(trapGrid.vertexList()); + + const Tf3D gridForm(vGrid[4], + vGrid[5], + vGrid[6], // Grid inside HAW + vHAW[5] - Pt3D(0, h_Grid, 0), + vHAW[5], + vHAW[6]); + + if (0 != grid.here) { + hawRLog.placeVolume( + gridLog, + copyOne, + Transform3D( + myrot(ns, grid.name + "R", gridForm.getRotation()), + Position(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << gridLog.name() << ":" << copyOne << " positioned in " << hawRLog.name() << " at (" + << cms::convert2mm(gridForm.getTranslation().x()) << "," + << cms::convert2mm(gridForm.getTranslation().y()) << "," + << cms::convert2mm(gridForm.getTranslation().z()) << ") with rotation"; +#endif + } + // End Grid + Tablet insertion + + // begin filling Wedge with crystal plus supports -------------------------- + + const double aNom(cry.nomCryDimAF); + const double LNom(cry.nomCryDimLZ); + + const double AUnd(cry.underAR); + const double aUnd(cry.underAF); + const double bUnd(cry.underCF); + const double HUnd(cry.underBR); + const double hUnd(cry.underBF); + const double LUnd(cry.underLZ); + + const double sWall(alv.wallThAlv); + const double sWrap(alv.wrapThAlv); + const double sClr(alv.clrThAlv); + + const double fWall(alv.wallFrAlv); + const double fWrap(alv.wrapFrAlv); + const double fClr(alv.clrFrAlv); + + const double rWall(alv.wallReAlv); + const double rWrap(alv.wrapReAlv); + const double rClr(alv.clrReAlv); + + // theta is angle in yz plane between z axis & leading edge of crystal + double theta(90_deg); + double zee(0); + double side(0); + double zeta(0_deg); // increment in theta for last crystal + + for (unsigned int cryType(1); cryType <= alv.nCryTypes; ++cryType) { + const string sType("_" + std::string(10 > cryType ? "0" : "") + std::to_string(cryType)); + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "Crytype=" << cryType; +#endif + const double ANom(cry.vecNomCryDimAR[cryType - 1]); + const double BNom(cry.vecNomCryDimCR[cryType - 1]); + const double bNom(cry.vecNomCryDimCF[cryType - 1]); + const double HNom(cry.vecNomCryDimBR[cryType - 1]); + const double hNom(cry.vecNomCryDimBF[cryType - 1]); + + const double alfCry(90_deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd))); + + const EcalTrap trapCry(0.5 * (ANom - AUnd), //double aHalfLengthXNegZLoY , // bl1, A/2 + 0.5 * (aNom - aUnd), //double aHalfLengthXPosZLoY , // bl2, a/2 + 0.5 * (bNom - bUnd), //double aHalfLengthXPosZHiY , // tl2, b/2 + 0.5 * (HNom - HUnd), //double aHalfLengthYNegZ , // h1, H/2 + 0.5 * (hNom - hUnd), //double aHalfLengthYPosZ , // h2, h/2 + 0.5 * (LNom - LUnd), //double aHalfLengthZ , // dz, L/2 + alfCry, //double aAngleAD , // alfa1 + aNom - aUnd - ANom + AUnd, //double aCoord15X , // x15 + hNom - hUnd - HNom + HUnd //double aCoord15Y // y15 + ); + + const string cryDDName(cry.name + sType); + Solid crySolid = mytrap(cry.name, trapCry); + Volume cryLog = Volume(cryDDName, crySolid, ns.material(cry.mat)); + + //++++++++++++++++++++++++++++++++++ APD ++++++++++++++++++++++++++++++++++ + const unsigned int copyCap(1); + const string capDDName(cap.name + sType); + Solid capSolid = Box(capDDName, cap.xSizeHalf, cap.ySizeHalf, cap.thickHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << capDDName << " Box " << cms::convert2mm(cap.xSizeHalf) << ":" + << cms::convert2mm(cap.ySizeHalf) << ":" << cms::convert2mm(cap.thickHalf); +#endif + Volume capLog = Volume(capDDName, capSolid, ns.material(cap.mat)); + + const string sglDDName(apd.sglName + sType); + Solid sglSolid = Box(sglDDName, cap.xSizeHalf, cap.ySizeHalf, apd.sglThick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << sglDDName << " Box " << cms::convert2mm(cap.xSizeHalf) << ":" + << cms::convert2mm(cap.ySizeHalf) << ":" << cms::convert2mm(apd.sglThick / 2.); +#endif + Volume sglLog = Volume(sglDDName, sglSolid, ns.material(apd.sglMat)); + const unsigned int copySGL(1); + + const string cerDDName(cer.name + sType); + Solid cerSolid = Box(cerDDName, cer.xSizeHalf, cer.ySizeHalf, cer.thickHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << cerDDName << " Box " << cms::convert2mm(cer.xSizeHalf) << ":" + << cms::convert2mm(cer.ySizeHalf) << ":" << cms::convert2mm(cer.thickHalf); +#endif + Volume cerLog = Volume(cerDDName, cerSolid, ns.material(cer.mat)); + unsigned int copyCER(0); + + const string bsiDDName(bSi.name + sType); + Solid bsiSolid = Box(bsiDDName, bSi.xSizeHalf, bSi.ySizeHalf, bSi.thickHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << bsiDDName << " Box " << cms::convert2mm(bSi.xSizeHalf) << ":" + << cms::convert2mm(bSi.ySizeHalf) << ":" << cms::convert2mm(bSi.thickHalf); +#endif + Volume bsiLog = Volume(bsiDDName, bsiSolid, ns.material(bSi.mat)); + const unsigned int copyBSi(1); + + const string atjDDName(apd.atjName + sType); + Solid atjSolid = Box(atjDDName, 0.5 * apd.side, 0.5 * apd.side, apd.atjThickHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << atjDDName << " Box " << cms::convert2mm(0.5 * apd.side) << ":" + << cms::convert2mm(0.5 * apd.side) << ":" << cms::convert2mm(apd.atjThickHalf); +#endif + Volume atjLog = Volume(atjDDName, atjSolid, ns.material(apd.atjMat)); + const unsigned int copyATJ(1); + + const string aglDDName(apd.aglName + sType); + Solid aglSolid = Box(aglDDName, bSi.xSizeHalf, bSi.ySizeHalf, 0.5 * apd.aglThick); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << aglDDName << " Box " << cms::convert2mm(bSi.xSizeHalf) << ":" + << cms::convert2mm(bSi.ySizeHalf) << ":" << cms::convert2mm(0.5 * apd.aglThick); +#endif + Volume aglLog = Volume(aglDDName, aglSolid, ns.material(apd.aglMat)); + const unsigned int copyAGL(1); + + const string andDDName(apd.andName + sType); + Solid andSolid = Box(andDDName, 0.5 * apd.side, 0.5 * apd.side, 0.5 * apd.andThick); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << andDDName << " Box " << cms::convert2mm(0.5 * apd.side) << ":" + << cms::convert2mm(0.5 * apd.side) << ":" << cms::convert2mm(0.5 * apd.andThick); +#endif + Volume andLog = Volume(andDDName, andSolid, ns.material(apd.andMat)); + const unsigned int copyAND(1); + + const string apdDDName(apd.name + sType); + Solid apdSolid = Box(apdDDName, 0.5 * apd.side, 0.5 * apd.side, 0.5 * apd.thick); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << apdDDName << " Box " << cms::convert2mm(0.5 * apd.side) << ":" + << cms::convert2mm(0.5 * apd.side) << ":" << cms::convert2mm(0.5 * apd.thick); +#endif + Volume apdLog = Volume(apdDDName, apdSolid, ns.material(apd.mat)); + const unsigned int copyAPD(1); + + //++++++++++++++++++++++++++++++++++ END APD ++++++++++++++++++++++++++++++++++ + + const double delta(atan((HNom - hNom) / LNom)); + const double sindelta(sin(delta)); + + const double gamma(atan((ANom - aNom) / LNom)); + const double singamma(sin(gamma)); + + const double beta(atan((BNom - bNom) / LNom)); + const double sinbeta(sin(beta)); + + // Now clearance trap + const double alfClr(90_deg + atan((bNom - aNom) / (hNom + sClr))); + + const EcalTrap trapClr(0.5 * (ANom + sClr + rClr * singamma), //double aHalfLengthXNegZLoY , // bl1, A/2 + 0.5 * (aNom + sClr - fClr * singamma), //double aHalfLengthXPosZLoY , // bl2, a/2 + 0.5 * (bNom + sClr - fClr * sinbeta), //double aHalfLengthXPosZHiY , // tl2, b/2 + 0.5 * (HNom + sClr + rClr * sindelta), //double aHalfLengthYNegZ , // h1, H/2 + 0.5 * (hNom + sClr - fClr * sindelta), //double aHalfLengthYPosZ , // h2, h/2 + 0.5 * (LNom + fClr + rClr), // dz, L/2 + alfClr, //double aAngleAD , // alfa1 + aNom - ANom, //double aCoord15X , // x15 + hNom - HNom //double aCoord15Y // y15 + ); + + const string clrDDName(cry.clrName + sType); + Solid clrSolid = mytrap(clrDDName, trapClr); + Volume clrLog = Volume(clrDDName, clrSolid, ns.material(cry.clrMat)); + + // Now wrap trap + const double alfWrap(90_deg + atan((bNom - aNom) / (hNom + sClr + 2. * sWrap))); + + const EcalTrap trapWrap(0.5 * (trapClr.A() + 2. * sWrap + rWrap * singamma), // bl1, A/2 + 0.5 * (trapClr.a() + 2. * sWrap - fWrap * singamma), // bl2, a/2 + 0.5 * (trapClr.b() + 2. * sWrap - fWrap * sinbeta), // tl2, b/2 + 0.5 * (trapClr.H() + 2. * sWrap + rWrap * sindelta), // h1, H/2 + 0.5 * (trapClr.h() + 2. * sWrap - fWrap * sindelta), // h2, h/2 + 0.5 * (trapClr.L() + fWrap + rWrap), // dz, L/2 + alfWrap, //double aAngleAD , // alfa1 + aNom - ANom - (cryType > 9 ? 0 : 0.020 * dd4hep::mm), + hNom - HNom //double aCoord15Y // y15 + ); + + const string wrapDDName(cry.wrapName + sType); + Solid wrapSolid = mytrap(wrapDDName, trapWrap); + Volume wrapLog = Volume(wrapDDName, wrapSolid, ns.material(cry.wrapMat)); + + // Now wall trap + + const double alfWall(90_deg + atan((bNom - aNom) / (hNom + sClr + 2. * sWrap + 2. * sWall))); + + const EcalTrap trapWall(0.5 * (trapWrap.A() + 2 * sWall + rWall * singamma), // A/2 + 0.5 * (trapWrap.a() + 2 * sWall - fWall * singamma), // a/2 + 0.5 * (trapWrap.b() + 2 * sWall - fWall * sinbeta), // b/2 + 0.5 * (trapWrap.H() + 2 * sWall + rWall * sindelta), // H/2 + 0.5 * (trapWrap.h() + 2 * sWall - fWall * sindelta), // h/2 + 0.5 * (trapWrap.L() + fWall + rWall), // L/2 + alfWall, // alfa1 + aNom - ANom - (cryType < 10 ? 0.150 * dd4hep::mm : 0.100 * dd4hep::mm), + hNom - HNom // y15 + ); + + const string wallDDName(cry.wallName + sType); + Solid wallSolid = mytrap(wallDDName, trapWall); + Volume wallLog = Volume(wallDDName, wallSolid, ns.material(cry.wallMat)); + + // Now for placement of cry within clr + const Vec3 cryToClr(0., 0., 0.5 * (rClr - fClr)); + clrLog.placeVolume(cryLog, copyOne, Position(0, 0, 0.5 * (rClr - fClr))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << cryLog.name() << ":" << copyOne << " positioned in " << clrLog.name() + << " at (0,0," << cms::convert2mm(0.5 * (rClr - fClr)) << ") with no rotation"; +#endif + if (0 != cap.here) { + bsiLog.placeVolume(aglLog, copyAGL, Position(0, 0, -0.5 * apd.aglThick + bSi.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << aglLog.name() << ":" << copyAGL << " positioned in " << bsiLog.name() + << " at (0,0," << cms::convert2mm(-0.5 * apd.aglThick + bSi.thickHalf) + << ") with no rotation"; +#endif + bsiLog.placeVolume(andLog, copyAND, Position(0, 0, -0.5 * apd.andThick - apd.aglThick + bSi.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << andLog.name() << ":" << copyAND << " positioned in " << bsiLog.name() + << " at (0,0," + << cms::convert2mm(-0.5 * apd.andThick - apd.aglThick + bSi.thickHalf) + << ") with no rotation"; +#endif + bsiLog.placeVolume( + apdLog, copyAPD, Position(0, 0, -0.5 * apd.thick - apd.andThick - apd.aglThick + bSi.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << apdLog.name() << ":" << copyAPD << " positioned in " << bsiLog.name() + << " at (0,0," + << cms::convert2mm(-0.5 * apd.thick - apd.andThick - apd.aglThick + bSi.thickHalf) + << ") with no rotation"; +#endif + bsiLog.placeVolume(atjLog, + copyATJ, + Position(0, 0, -apd.atjThickHalf - apd.thick - apd.andThick - apd.aglThick + bSi.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << atjLog.name() << ":" << copyATJ << " positioned in " << bsiLog.name() + << " at (0,0," + << cms::convert2mm(-apd.atjThickHalf - apd.thick - apd.andThick - apd.aglThick + + bSi.thickHalf) + << ") with no rotation"; +#endif + cerLog.placeVolume(bsiLog, copyBSi, Position(0, 0, -bSi.thickHalf + cer.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << bsiLog.name() << ":" << copyBSi << " positioned in " << cerLog.name() + << " at (0,0," << cms::convert2mm(-bSi.thickHalf + cer.thickHalf) + << ") with no rotation"; +#endif + capLog.placeVolume(sglLog, copySGL, Position(0, 0, -0.5 * apd.sglThick + cap.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << sglLog.name() << ":" << copySGL << " positioned in " << capLog.name() + << " at (0,0," << cms::convert2mm(-0.5 * apd.sglThick + cap.thickHalf) + << ") with no rotation"; +#endif + + for (unsigned int ijkl(0); ijkl != 2; ++ijkl) { + capLog.placeVolume(cerLog, + ++copyCER, + Position(trapCry.bl1() - (0 == ijkl ? apd.x1 : apd.x2), + trapCry.h1() - apd.z, + -apd.sglThick - cer.thickHalf + cap.thickHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << cerLog.name() << ":" << copyCER << " positioned in " << capLog.name() + << " at (" << cms::convert2mm(trapCry.bl1() - (0 == ijkl ? apd.x1 : apd.x2)) + << "," << cms::convert2mm(trapCry.h1() - apd.z) << "," + << cms::convert2mm(-apd.sglThick - cer.thickHalf + cap.thickHalf) + << ") with no rotation"; +#endif + } + clrLog.placeVolume(capLog, copyCap, Position(0, 0, -trapCry.dz() - cap.thickHalf + 0.5 * (rClr - fClr))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << capLog.name() << ":" << copyCap << " positioned in " << clrLog.name() + << " at (0,0," + << cms::convert2mm(-trapCry.dz() - cap.thickHalf + 0.5 * (rClr - fClr)) + << ") with no rotation"; +#endif + } + + const Vec3 clrToWrap(0, 0, 0.5 * (rWrap - fWrap)); + wrapLog.placeVolume(clrLog, copyOne, Position(0, 0, 0.5 * (rWrap - fWrap))); //SAME as cryToWrap +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << clrLog.name() << ":" << copyOne << " positioned in " << wrapLog.name() + << " at (0,0," << cms::convert2mm(0.5 * (rWrap - fWrap)) << ") with no rotation"; +#endif + + // Now for placement of clr within wall + const Vec3 wrapToWall1(0, 0, 0.5 * (rWall - fWall)); + const Vec3 wrapToWall(Vec3((cryType > 9 ? 0 : 0.005 * dd4hep::mm), 0, 0) + wrapToWall1); + wallLog.placeVolume( + wrapLog, + copyOne, + Position(Vec3((cryType > 9 ? 0 : 0.005 * dd4hep::mm), 0, 0) + wrapToWall1)); //SAME as wrapToWall +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << wrapLog.name() << ":" << copyOne << " positioned in " << wallLog.name() << " at (" + << cms::convert2mm(wrapToWall.x()) << "," << cms::convert2mm(wrapToWall.y()) << "," + << cms::convert2mm(wrapToWall.z()) << ") with no rotation"; +#endif + + const EcalTrap::VertexList vWall(trapWall.vertexList()); + const EcalTrap::VertexList vCry(trapCry.vertexList()); + + const double sidePrime(0.5 * (trapWall.a() - trapCry.a())); + const double frontPrime(fWall + fWrap + fClr + 0.5 * LUnd); + + // define web plates with clearance =========================================== + + if (1 == cryType) // first web plate: inside clearance volume + { + const unsigned int iWeb(0); + const Pt3D corner(vHAW[4] + Pt3D(0, alvWedge.hawYOffCry, 0)); + const unsigned int copyOne(1); + const double LWebx(web.vecWebLength[iWeb]); + const double BWebx(trapWall.b() + (trapWall.B() - trapWall.b()) * LWebx / trapWall.L()); + + const double thick(web.vecWebPlTh[iWeb] + web.vecWebClrTh[iWeb]); + const EcalTrap trapWebClr(0.5 * BWebx, // A/2 + 0.5 * trapWall.b(), // a/2 + 0.5 * trapWall.b(), // b/2 + 0.5 * thick, // H/2 + 0.5 * thick, // h/2 + 0.5 * LWebx, // L/2 + 90_deg, // alfa1 + trapWall.b() - BWebx, // x15 + 0 // y15 + ); + std::string webClrName(web.clrName + std::to_string(iWeb)); + Solid webClrSolid = mytrap(webClrName, trapWebClr); + Volume webClrLog = Volume(webClrName, webClrSolid, ns.material(web.clrMat)); + + const EcalTrap trapWebPl(0.5 * trapWebClr.A(), // A/2 + 0.5 * trapWebClr.a(), // a/2 + 0.5 * trapWebClr.b(), // b/2 + 0.5 * web.vecWebPlTh[iWeb], // H/2 + 0.5 * web.vecWebPlTh[iWeb], // h/2 + 0.5 * trapWebClr.L(), // L/2 + 90._deg, // alfa1 + trapWebClr.b() - trapWebClr.B(), // x15 + 0 // y15 + ); + std::string webPlName(web.plName + std::to_string(iWeb)); + Solid webPlSolid = mytrap(webPlName, trapWebPl); + Volume webPlLog = Volume(webPlName, webPlSolid, ns.material(web.plMat)); + + webClrLog.placeVolume(webPlLog, copyOne); // place plate inside clearance volume +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << webPlLog.name() << ":" << copyOne << " positioned in " << webClrName + << " at (0,0,0) with no rotation"; +#endif + const EcalTrap::VertexList vWeb(trapWebClr.vertexList()); + + zee += trapWebClr.h() / sin(theta); + + const double beta(theta + delta); + + const double zWeb(zee - frontPrime * cos(beta) + sidePrime * sin(beta)); + const double yWeb(frontPrime * sin(beta) + sidePrime * cos(beta)); + + const Pt3D wedge3(corner + Pt3D(0, -yWeb, zWeb)); + const Pt3D wedge2(wedge3 + Pt3D(0, trapWebClr.h() * cos(theta), -trapWebClr.h() * sin(theta))); + const Pt3D wedge1(wedge3 + Pt3D(trapWebClr.a(), 0, 0)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "trap1=" << vWeb[0] << ", trap2=" << vWeb[2] << ", trap3=" << vWeb[3]; + edm::LogVerbatim("EcalGeom") << "wedge1=" << wedge1 << ", wedge2=" << wedge2 << ", wedge3=" << wedge3; +#endif + const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3); + + if (0 != web.here) { + hawRLog.placeVolume( + webClrLog, + copyOne, + Transform3D( + myrot(ns, webClrName + std::to_string(iWeb), tForm.getRotation()), + Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << webClrLog.name() << ":" << copyOne << " positioned in " << hawRLog.name() + << " at (" << cms::convert2mm(tForm.getTranslation().x()) << "," + << cms::convert2mm(tForm.getTranslation().y()) << "," + << cms::convert2mm(tForm.getTranslation().z()) << ") with rotation"; +#endif + } + zee += alv.vecGapAlvEta[0]; + } + + for (unsigned int etaAlv(1); etaAlv <= alv.nCryPerAlvEta; ++etaAlv) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "theta=" << convertRadToDeg(theta) << ", sidePrime=" << sidePrime + << ", frontPrime=" << frontPrime << ", zeta=" << zeta << ", delta=" << delta + << ", zee=" << zee; +#endif + + zee += 0.075 * dd4hep::mm + (side * cos(zeta) + trapWall.h() - sidePrime) / sin(theta); + + // make transform for placing enclosed crystal + + const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall); + + const Pt3D trap3(trap2 + Pt3D(0, -trapCry.h(), 0)); + const Pt3D trap1(trap3 + Pt3D(-trapCry.a(), 0, 0)); + + const Pt3D wedge3(vHAW[4] + Pt3D(sidePrime, alvWedge.hawYOffCry, zee)); + const Pt3D wedge2(wedge3 + Pt3D(0, trapCry.h() * cos(theta), -trapCry.h() * sin(theta))); + const Pt3D wedge1(wedge3 + Pt3D(trapCry.a(), 0, 0)); + + const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3); + + const double xx(0.050 * dd4hep::mm); + + const Tf3D tForm(HepGeom::Translate3D(xx, 0, 0) * tForm1); + hawRLog.placeVolume( + wallLog, + etaAlv, + Transform3D(myrot(ns, wallDDName + "_" + std::to_string(etaAlv), tForm.getRotation()), + Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << wallLog.name() << ":" << etaAlv << " positioned in " << hawRLog.name() << " at (" + << cms::convert2mm(tForm.getTranslation().x()) << "," + << cms::convert2mm(tForm.getTranslation().y()) << "," + << cms::convert2mm(tForm.getTranslation().z()) << ") with rotation"; +#endif + theta -= delta; + side = sidePrime; + zeta = delta; + } + if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType) { // web plates + zee += 0.5 * alv.vecGapAlvEta[cryType] / sin(theta); + + const unsigned int iWeb(cryType / 4); + const Pt3D corner(vHAW[4] + Pt3D(0, alvWedge.hawYOffCry, 0)); + const unsigned int copyOne(1); + const double LWebx(web.vecWebLength[iWeb]); + const double BWebx(trapWall.a() + (trapWall.A() - trapWall.a()) * LWebx / trapWall.L()); + + const double thick(web.vecWebPlTh[iWeb] + web.vecWebClrTh[iWeb]); + const EcalTrap trapWebClr(0.5 * BWebx, // A/2 + 0.5 * trapWall.a(), // a/2 + 0.5 * trapWall.a(), // b/2 + 0.5 * thick, // H/2 + 0.5 * thick, // h/2 + 0.5 * LWebx, // L/2 + 90_deg, // alfa1 + trapWall.a() - BWebx, // x15 + 0 // y15 + ); + std::string webClrName(web.clrName + std::to_string(iWeb)); + Solid webClrSolid = mytrap(webClrName, trapWebClr); + Volume webClrLog = Volume(webClrName, webClrSolid, ns.material(web.clrMat)); + + const EcalTrap trapWebPl(0.5 * trapWebClr.A(), // A/2 + 0.5 * trapWebClr.a(), // a/2 + 0.5 * trapWebClr.b(), // b/2 + 0.5 * web.vecWebPlTh[iWeb], // H/2 + 0.5 * web.vecWebPlTh[iWeb], // h/2 + 0.5 * trapWebClr.L(), // L/2 + 90._deg, // alfa1 + trapWebClr.b() - trapWebClr.B(), // x15 + 0 // y15 + ); + std::string webPlName(web.plName + std::to_string(iWeb)); + Solid webPlSolid = mytrap(webPlName, trapWebPl); + Volume webPlLog = Volume(webPlName, webPlSolid, ns.material(web.plMat)); + + webClrLog.placeVolume(webPlLog, copyOne); // place plate inside clearance volume +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << webPlLog.name() << ":" << copyOne << " positioned in " << webClrName + << " at (0,0,0) with no rotation"; +#endif + const EcalTrap::VertexList vWeb(trapWebClr.vertexList()); + + zee += trapWebClr.h() / sin(theta); + + const double beta(theta + delta); + + const double zWeb(zee - frontPrime * cos(beta) + sidePrime * sin(beta)); + const double yWeb(frontPrime * sin(beta) + sidePrime * cos(beta)); + + const Pt3D wedge3(corner + Pt3D(0, -yWeb, zWeb)); + const Pt3D wedge2(wedge3 + Pt3D(0, trapWebClr.h() * cos(theta), -trapWebClr.h() * sin(theta))); + const Pt3D wedge1(wedge3 + Pt3D(trapWebClr.a(), 0, 0)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "trap1=" << vWeb[0] << ", trap2=" << vWeb[2] << ", trap3=" << vWeb[3]; + edm::LogVerbatim("EcalGeom") << "wedge1=" << wedge1 << ", wedge2=" << wedge2 << ", wedge3=" << wedge3; +#endif + const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3); + + if (0 != web.here) { + hawRLog.placeVolume( + webClrLog, + copyOne, + Transform3D( + myrot(ns, webClrName + std::to_string(iWeb), tForm.getRotation()), + Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << webClrLog.name() << ":" << copyOne << " positioned in " << hawRLog.name() + << " at (" << cms::convert2mm(tForm.getTranslation().x()) << "," + << cms::convert2mm(tForm.getTranslation().y()) << "," + << cms::convert2mm(tForm.getTranslation().z()) << ") with rotation"; +#endif + } + + zee += 0.5 * alv.vecGapAlvEta[cryType] / sin(theta); + } else { + if (17 != cryType) + zee += alv.vecGapAlvEta[cryType] / sin(theta); + } + } + // END filling Wedge with crystal plus supports -------------------------- + + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //**************** Material at outer radius of supermodule *************** + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + + if (0 != back.here) { + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Back Cover Plate !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const Position outtra(back.xOff + 0.5 * back.sideHeight, back.yOff, 0.5 * back.sideLength); + + const double realBPthick(back.plateThick + back.plate2Thick); + array backPlateParms{{0.5 * back.plateWidth, 0.5 * realBPthick, 0.5 * back.plateLength}}; + Solid backPlateSolid = Box(back.plateName, backPlateParms[0], backPlateParms[1], backPlateParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << back.plateName << " Box " << cms::convert2mm(backPlateParms[0]) << ":" + << cms::convert2mm(backPlateParms[1]) << ":" << cms::convert2mm(backPlateParms[2]); +#endif + Volume backPlateLog = Volume(back.plateName, backPlateSolid, ns.material(back.plateMat)); + + const Position backPlateTra( + 0.5 * back.sideHeight + backPlateParms[1], 0, backPlateParms[2] - 0.5 * back.sideLength); + + Solid backPlate2Solid = + Box(back.plate2Name, 0.5 * back.plateWidth, 0.5 * back.plate2Thick, 0.5 * back.plateLength); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << back.plate2Name << " Box " << cms::convert2mm(0.5 * back.plateWidth) << ":" + << cms::convert2mm(0.5 * back.plate2Thick) << ":" + << cms::convert2mm(0.5 * back.plateLength); +#endif + Volume backPlate2Log = Volume(back.plate2Name, backPlate2Solid, ns.material(back.plate2Mat)); + + const Position backPlate2Tra(0, -backPlateParms[1] + back.plate2Thick / 2., 0); + if (0 != back.plateHere) { + backPlateLog.placeVolume(backPlate2Log, copyOne, Transform3D(backPlate2Tra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backPlate2Log.name() << ":" << copyOne << " positioned in " + << backPlateLog.name() << " at (" << cms::convert2mm(backPlate2Tra.x()) << "," + << cms::convert2mm(backPlate2Tra.y()) << "," << cms::convert2mm(backPlate2Tra.z()) + << ") with no rotation"; +#endif + spmLog.placeVolume( + backPlateLog, + copyOne, + Transform3D(myrot(ns, back.plateName + "Rot5", CLHEP::HepRotationZ(270_deg)), outtra + backPlateTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backPlateLog.name() << ":" << copyOne << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm((outtra + backPlateTra).x()) << "," + << cms::convert2mm((outtra + backPlateTra).y()) << "," + << cms::convert2mm((outtra + backPlateTra).z()) << ") with rotation"; +#endif + } + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Back Cover Plate !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Back Side Plates !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const EcalTrap trapBS(back.sideWidth / 2., //double aHalfLengthXNegZLoY , // bl1, A/2 + back.sideWidth / 2., //double aHalfLengthXPosZLoY , // bl2, a/2 + back.sideWidth / 4., //double aHalfLengthXPosZHiY , // tl2, b/2 + back.sideHeight / 2., //double aHalfLengthYNegZ , // h1, H/2 + back.sideHeight / 2., //double aHalfLengthYPosZ , // h2, h/2 + back.sideLength / 2., //double aHalfLengthZ , // dz, L/2 + back.sideAngle, //double aAngleAD , // alfa1 + 0, //double aCoord15X , // x15 + 0 //double aCoord15Y // y15 + ); + + Solid backSideSolid = mytrap(back.sideName, trapBS); + Volume backSideLog = Volume(back.sideName, backSideSolid, ns.material(back.sideMat)); + + const Position backSideTra1(0, back.plateWidth / 2 + back.sideYOff1, 1 * dd4hep::mm); + if (0 != back.sideHere) { + spmLog.placeVolume( + backSideLog, + copyOne, + Transform3D(myrot(ns, back.sideName + "Rot8", CLHEP::HepRotationX(180_deg) * CLHEP::HepRotationZ(90_deg)), + outtra + backSideTra1)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backSideLog.name() << ":" << copyOne << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm((outtra + backSideTra1).x()) << "," + << cms::convert2mm((outtra + backSideTra1).y()) << "," + << cms::convert2mm((outtra + backSideTra1).z()) << ") with rotation"; +#endif + const Position backSideTra2(0, -back.plateWidth / 2 + back.sideYOff2, 1 * dd4hep::mm); + spmLog.placeVolume( + backSideLog, + copyTwo, + Transform3D(myrot(ns, back.sideName + "Rot9", CLHEP::HepRotationZ(90_deg)), outtra + backSideTra2)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backSideLog.name() << ":" << copyTwo << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm((outtra + backSideTra2).x()) << "," + << cms::convert2mm((outtra + backSideTra2).y()) << "," + << cms::convert2mm((outtra + backSideTra2).z()) << ") with rotation"; +#endif + } + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Back Side Plates !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //===================== + const double backCoolWidth(backCool.barWidth + 2. * backCoolTank.width); + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Mother Board Cooling Manifold Setup !!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const double manifCut(2 * dd4hep::mm); + + Solid mBManifSolid = Tube(0, mbManif.outDiam / 2, backCoolWidth / 2. - manifCut, 0_deg, 360_deg); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << mbManif.name << " Tubs " << cms::convert2mm(backCoolWidth / 2. - manifCut) + << ":0:" << cms::convert2mm(mbManif.outDiam / 2) << ":0:360"; +#endif + Volume mBManifLog = Volume(mbManif.name, mBManifSolid, ns.material(mbManif.mat)); + + const string mBManifWaName(mbManif.name + "Wa"); + Solid mBManifWaSolid = Tube(0, mbManif.innDiam / 2, backCoolWidth / 2. - manifCut, 0_deg, 360_deg); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << mBManifWaName << " Tubs " << cms::convert2mm(backCoolWidth / 2. - manifCut) + << ":0:" << cms::convert2mm(mbManif.innDiam / 2) << ":0:360"; +#endif + Volume mBManifWaLog(mBManifWaName, mBManifWaSolid, ns.material(backPipe.waterMat)); + mBManifLog.placeVolume(mBManifWaLog, copyOne); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << mBManifWaLog.name() << ":" << copyOne << " positioned in " << mBManifLog.name() + << " at (0,0,0) with no rotation"; +#endif + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Mother Board Cooling Manifold Setup !!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //===================== + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Loop over Grilles & MB Cooling Manifold !!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + const double deltaY(-5 * dd4hep::mm); + + Solid grEdgeSlotSolid = + Box(grille.edgeSlotName, grille.edgeSlotHeight / 2., grille.edgeSlotWidth / 2., grille.thick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << grille.edgeSlotName << " Box " << cms::convert2mm(grille.edgeSlotHeight / 2.) << ":" + << cms::convert2mm(grille.edgeSlotWidth / 2.) << ":" + << cms::convert2mm(grille.thick / 2.); +#endif + Volume grEdgeSlotLog = Volume(grille.edgeSlotName, grEdgeSlotSolid, ns.material(grille.edgeSlotMat)); + + unsigned int edgeSlotCopy(0); + unsigned int midSlotCopy(0); + + Volume grMidSlotLog[4]; + + for (unsigned int iGr(0); iGr != grille.vecHeight.size(); ++iGr) { + string gName(grille.name + std::to_string(iGr)); + Solid grilleSolid = Box(gName, grille.vecHeight[iGr] / 2., backCoolWidth / 2., grille.thick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << gName << " Box " << cms::convert2mm(grille.vecHeight[iGr] / 2.) << ":" + << cms::convert2mm(backCoolWidth / 2.) << ":" << cms::convert2mm(grille.thick / 2.); +#endif + Volume grilleLog = Volume(gName, grilleSolid, ns.material(grille.mat)); + + const Position grilleTra(-realBPthick / 2 - grille.vecHeight[iGr] / 2, + deltaY, + grille.vecZOff[iGr] + grille.thick / 2 - back.sideLength / 2); + const Position gTra(outtra + backPlateTra + grilleTra); + + if (0 != grille.midSlotHere && 0 != iGr) { + if (0 == (iGr - 1) % 2) { + string mName(grille.midSlotName + std::to_string(iGr / 2)); + Solid grMidSlotSolid = + Box(mName, grille.vecMidSlotHeight[(iGr - 1) / 2] / 2., grille.midSlotWidth / 2., grille.thick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << mName << " Box " + << cms::convert2mm(grille.vecMidSlotHeight[(iGr - 1) / 2] / 2.) << ":" + << cms::convert2mm(grille.midSlotWidth / 2.) << ":" + << cms::convert2mm(grille.thick / 2.); +#endif + grMidSlotLog[(iGr - 1) / 2] = Volume(mName, grMidSlotSolid, ns.material(grille.midSlotMat)); + } + grilleLog.placeVolume( + grMidSlotLog[(iGr - 1) / 2], + ++midSlotCopy, + Transform3D(Position( + grille.vecHeight[iGr] / 2. - grille.vecMidSlotHeight[(iGr - 1) / 2] / 2., +grille.midSlotXOff, 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << grMidSlotLog[(iGr - 1) / 2].name() << ":" << midSlotCopy << " positioned in " + << grilleLog.name() << " at (" + << cms::convert2mm(grille.vecHeight[iGr] / 2. - + grille.vecMidSlotHeight[(iGr - 1) / 2] / 2.) + << "," << cms::convert2mm(grille.midSlotXOff) << ",0) with no rotation"; +#endif + grilleLog.placeVolume( + grMidSlotLog[(iGr - 1) / 2], + ++midSlotCopy, + Transform3D(Position( + grille.vecHeight[iGr] / 2. - grille.vecMidSlotHeight[(iGr - 1) / 2] / 2., -grille.midSlotXOff, 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << grMidSlotLog[(iGr - 1) / 2].name() << ":" << midSlotCopy << " positioned in " + << grilleLog.name() << " at (" + << cms::convert2mm(grille.vecHeight[iGr] / 2. - + grille.vecMidSlotHeight[(iGr - 1) / 2] / 2.) + << "," << cms::convert2mm(-grille.midSlotXOff) << ",0) with no rotation"; +#endif + } + + if (0 != grille.edgeSlotHere && 0 != iGr) { + grilleLog.placeVolume(grEdgeSlotLog, + ++edgeSlotCopy, + Transform3D(Position(grille.vecHeight[iGr] / 2. - grille.edgeSlotHeight / 2., + backCoolWidth / 2 - grille.edgeSlotWidth / 2., + 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << grEdgeSlotLog.name() << ":" << edgeSlotCopy << " positioned in " + << grilleLog.name() << " at (" + << cms::convert2mm(grille.vecHeight[iGr] / 2. - grille.edgeSlotHeight / 2.) << "," + << cms::convert2mm(backCoolWidth / 2 - grille.edgeSlotWidth / 2.) + << ",0) with no rotation"; +#endif + grilleLog.placeVolume(grEdgeSlotLog, + ++edgeSlotCopy, + Transform3D(Position(grille.vecHeight[iGr] / 2. - grille.edgeSlotHeight / 2., + -backCoolWidth / 2 + grille.edgeSlotWidth / 2., + 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << grEdgeSlotLog.name() << ":" << edgeSlotCopy << " positioned in " + << grilleLog.name() << " at (" + << cms::convert2mm(grille.vecHeight[iGr] / 2. - grille.edgeSlotHeight / 2.) << "," + << cms::convert2mm(-backCoolWidth / 2 + grille.edgeSlotWidth / 2.) + << ",0) with no rotation"; +#endif + } + if (0 != grille.here) { + spmLog.placeVolume(grilleLog, iGr, Transform3D(gTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << grilleLog.name() << ":" << iGr << " positioned in " << spmLog.name() << " at (" + << cms::convert2mm(gTra.x()) << "," << cms::convert2mm(gTra.y()) << "," + << cms::convert2mm(gTra.z()) << ") with no rotation"; +#endif + } + + if ((0 != iGr % 2) && (0 != mbManif.here)) { + spmLog.placeVolume(mBManifLog, + iGr, + Transform3D(myrot(ns, mbManif.name + "R1", CLHEP::HepRotationX(90_deg)), + gTra - Position(-mbManif.outDiam / 2. + grille.vecHeight[iGr] / 2., + manifCut, + grille.thick / 2. + 3 * mbManif.outDiam / 2.))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << mBManifLog.name() << ":" << iGr << " positioned in " << spmLog.name() + << " at (" + << cms::convert2mm(gTra.x() + mbManif.outDiam / 2. - grille.vecHeight[iGr] / 2.) + << "," << cms::convert2mm(gTra.y() - manifCut) << "," + << cms::convert2mm(gTra.z() - grille.thick / 2. - 3 * mbManif.outDiam / 2.) + << ") with rotation"; +#endif + spmLog.placeVolume(mBManifLog, + iGr - 1, + Transform3D(myrot(ns, mbManif.name + "R2", CLHEP::HepRotationX(90_deg)), + gTra - Position(-3 * mbManif.outDiam / 2. + grille.vecHeight[iGr] / 2., + manifCut, + grille.thick / 2 + 3 * mbManif.outDiam / 2.))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << mBManifLog.name() << ":" << (iGr - 1) << " positioned in " << spmLog.name() + << " at (" + << cms::convert2mm(gTra.x() + 3 * mbManif.outDiam / 2. - + grille.vecHeight[iGr] / 2.) + << "," << cms::convert2mm(gTra.y() - manifCut) << "," + << cms::convert2mm(gTra.z() - grille.thick / 2 - 3 * mbManif.outDiam / 2.) + << ") with rotation"; +#endif + } + } + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Loop over Grilles & MB Cooling Manifold !!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Cooling Bar Setup !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + Solid backCoolBarSolid = + Box(backCool.barName, backCool.barHeight / 2., backCool.barWidth / 2., backCool.barThick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backCool.barName << " Box " << cms::convert2mm(backCool.barHeight / 2.) << ":" + << cms::convert2mm(backCool.barWidth / 2.) << ":" + << cms::convert2mm(backCool.barThick / 2.); +#endif + Volume backCoolBarLog = Volume(backCool.barName, backCoolBarSolid, ns.material(backCool.barMat)); + + Solid backCoolBarSSSolid = + Box(backCool.barSSName, backCool.barHeight / 2., backCool.barWidth / 2., backCool.barSSThick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backCool.barSSName << " Box " << cms::convert2mm(backCool.barHeight / 2.) << ":" + << cms::convert2mm(backCool.barWidth / 2.) << ":" + << cms::convert2mm(backCool.barSSThick / 2.); +#endif + Volume backCoolBarSSLog = Volume(backCool.barSSName, backCoolBarSSSolid, ns.material(backCool.barSSMat)); + const Position backCoolBarSSTra(0, 0, 0); + backCoolBarLog.placeVolume(backCoolBarSSLog, copyOne, Transform3D(backCoolBarSSTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolBarSSLog.name() << ":" << copyOne << " positioned in " + << backCoolBarLog.name() << " at (" << cms::convert2mm(backCoolBarSSTra.x()) << "," + << cms::convert2mm(backCoolBarSSTra.y()) << "," + << cms::convert2mm(backCoolBarSSTra.z()) << ") with no rotation"; +#endif + + Solid backCoolBarWaSolid = + Box(backCool.barWaName, backCool.barHeight / 2., backCool.barWidth / 2., backCool.barWaThick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backCool.barWaName << " Box " << cms::convert2mm(backCool.barHeight / 2.) << ":" + << cms::convert2mm(backCool.barWidth / 2.) << ":" + << cms::convert2mm(backCool.barWaThick / 2.); +#endif + Volume backCoolBarWaLog = Volume(backCool.barWaName, backCoolBarWaSolid, ns.material(backCool.barWaMat)); + const Position backCoolBarWaTra(0, 0, 0); + backCoolBarSSLog.placeVolume(backCoolBarWaLog, copyOne, Transform3D(backCoolBarWaTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolBarWaLog.name() << ":" << copyOne << " positioned in " + << backCoolBarSSLog.name() << " at (" << cms::convert2mm(backCoolBarWaTra.x()) << "," + << cms::convert2mm(backCoolBarWaTra.y()) << "," + << cms::convert2mm(backCoolBarWaTra.z()) << ") with no rotation"; +#endif + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Cooling Bar Setup !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin VFE Card Setup !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + double thickVFE(0); + for (unsigned int iLyr(0); iLyr != backCool.vecBackVFELyrThick.size(); ++iLyr) { + thickVFE += backCool.vecBackVFELyrThick[iLyr]; + } + Solid backVFESolid = + Box((myns + backCool.backVFEName), backCool.barHeight / 2., backCool.barWidth / 2., thickVFE / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << (myns + backCool.backVFEName) << " Box " << cms::convert2mm(backCool.barHeight / 2.) + << ":" << cms::convert2mm(backCool.barWidth / 2.) << ":" + << cms::convert2mm(thickVFE / 2.); +#endif + Volume backVFELog = + ns.addVolume(Volume(myns + backCool.backVFEName, backVFESolid, ns.material(backCool.backVFEMat))); + Position offTra(0, 0, -thickVFE / 2); + for (unsigned int iLyr(0); iLyr != backCool.vecBackVFELyrThick.size(); ++iLyr) { + Solid backVFELyrSolid = Box(backCool.vecBackVFELyrName[iLyr], + backCool.barHeight / 2., + backCool.barWidth / 2., + backCool.vecBackVFELyrThick[iLyr] / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backCool.vecBackVFELyrName[iLyr] << " Box " + << cms::convert2mm(backCool.barHeight / 2.) << ":" + << cms::convert2mm(backCool.barWidth / 2.) << ":" + << cms::convert2mm(backCool.vecBackVFELyrThick[iLyr] / 2.); +#endif + Volume backVFELyrLog = + Volume(backCool.vecBackVFELyrName[iLyr], backVFELyrSolid, ns.material(backCool.vecBackVFELyrMat[iLyr])); + const Position backVFELyrTra(0, 0, backCool.vecBackVFELyrThick[iLyr] / 2); + backVFELog.placeVolume(backVFELyrLog, copyOne, Transform3D(backVFELyrTra + offTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backVFELyrLog.name() << ":" << copyOne << " positioned in " << backVFELog.name() + << " at (" << cms::convert2mm((backVFELyrTra + offTra).x()) << "," + << cms::convert2mm((backVFELyrTra + offTra).y()) << "," + << cms::convert2mm((backVFELyrTra + offTra).z()) << ") with no rotation"; +#endif + offTra += 2 * backVFELyrTra; + } + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End VFE Card Setup !!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Cooling Bar + VFE Setup !!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const double halfZCoolVFE(thickVFE + backCool.barThick / 2.); + Solid backCoolVFESolid = Box(backCool.barHeight / 2., backCool.barWidth / 2., halfZCoolVFE); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backCool.vFEName << " Box " << cms::convert2mm(backCool.barHeight / 2.) << ":" + << cms::convert2mm(backCool.barWidth / 2.) << ":" << cms::convert2mm(halfZCoolVFE); +#endif + Volume backCoolVFELog = ns.addVolume(Volume(backCool.vFEName, backCoolVFESolid, ns.material(backCool.vFEMat))); + if (0 != backCool.barHere) { + backCoolVFELog.placeVolume(backCoolBarLog, copyOne, Transform3D()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolBarLog.name() << ":" << copyOne << " positioned in " + << backCoolVFELog.name() << " at (0,0,0) with no rotation"; +#endif + } + if (0 != backCool.vFEHere) { + backCoolVFELog.placeVolume( + backVFELog, copyOne, Transform3D(Position(0, 0, backCool.barThick / 2. + thickVFE / 2.))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backVFELog.name() << ":" << copyOne << " positioned in " << backCoolVFELog.name() + << " at (0,0," << cms::convert2mm(backCool.barThick / 2. + thickVFE / 2.) + << ") with no rotation"; +#endif + } + backCoolVFELog.placeVolume(backVFELog, + copyTwo, + Transform3D(myrot(ns, backCool.vFEName + "Flip", CLHEP::HepRotationX(180_deg)), + Position(0, 0, -backCool.barThick / 2. - thickVFE / 2.))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backVFELog.name() << ":" << copyTwo << " positioned in " << backCoolVFELog.name() + << " at (0,0," << cms::convert2mm(-backCool.barThick / 2. - thickVFE / 2.) + << ") with rotation"; +#endif + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Cooling Bar + VFE Setup !!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Placement of Readout & Cooling by Module !!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + unsigned int iCVFECopy(1); + unsigned int iSep(0); + unsigned int iNSec(0); + const unsigned int nMisc(backMisc.vecThick.size() / 4); + for (unsigned int iMod(0); iMod != 4; ++iMod) { + const double pipeLength(grille.vecZOff[2 * iMod + 1] - grille.vecZOff[2 * iMod] - grille.thick - + 3 * dd4hep::mm); + const double pipeZPos(grille.vecZOff[2 * iMod + 1] - pipeLength / 2 - 1.5 * dd4hep::mm); + + // accumulate total height of parent volume + double backCoolHeight(backCool.barHeight + mbCoolTube.outDiam); + for (unsigned int iMisc(0); iMisc != nMisc; ++iMisc) { + backCoolHeight += backMisc.vecThick[iMod * nMisc + iMisc]; + } + double bottomThick(mbCoolTube.outDiam); + for (unsigned int iMB(0); iMB != mbLyr.vecMBLyrThick.size(); ++iMB) { + backCoolHeight += mbLyr.vecMBLyrThick[iMB]; + bottomThick += mbLyr.vecMBLyrThick[iMB]; + } + + const double halfZBCool((pipeLength - 2 * mbManif.outDiam - grille.zSpace) / 2); + Solid backCoolSolid = Box(backCool.vecName[iMod], backCoolHeight / 2., backCoolWidth / 2., halfZBCool); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backCool.vecName[iMod] << " Box " << cms::convert2mm(backCoolHeight / 2.) << ":" + << cms::convert2mm(backCoolWidth / 2.) << ":" << cms::convert2mm(halfZBCool); +#endif + Volume backCoolLog = Volume(backCool.vecName[iMod], backCoolSolid, ns.material(spm.mat)); + + const Position bCoolTra( + -realBPthick / 2 + backCoolHeight / 2 - grille.vecHeight[2 * iMod], + deltaY, + grille.vecZOff[2 * iMod] + grille.thick + grille.zSpace + halfZBCool - back.sideLength / 2); + if (0 != backCool.here) { + spmLog.placeVolume(backCoolLog, iMod + 1, outtra + backPlateTra + bCoolTra); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolLog.name() << ":" << (iMod + 1) << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm((outtra + backPlateTra + bCoolTra).x()) << "," + << cms::convert2mm((outtra + backPlateTra + bCoolTra).y()) << "," + << cms::convert2mm((outtra + backPlateTra + bCoolTra).z()) + << ") with no rotation"; +#endif + } + + //=== + const double backCoolTankHeight(backCool.barHeight); // - backBracketHeight() ) ; + const double halfZTank(halfZBCool - 5 * dd4hep::cm); + + string bTankName(backCoolTank.name + std::to_string(iMod + 1)); + Solid backCoolTankSolid = Box(bTankName, backCoolTankHeight / 2., backCoolTank.width / 2., halfZTank); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << bTankName << " Box " << cms::convert2mm(backCoolTankHeight / 2.) << ":" + << cms::convert2mm(backCoolTank.width / 2.) << ":" << cms::convert2mm(halfZTank); +#endif + Volume backCoolTankLog = Volume(bTankName, backCoolTankSolid, ns.material(backCoolTank.mat)); + if (0 != backCoolTank.here) { + backCoolLog.placeVolume(backCoolTankLog, + copyOne, + Transform3D(Rotation3D(), + Position(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick, + backCool.barWidth / 2. + backCoolTank.width / 2., + 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolTankLog.name() << ":" << copyOne << " positioned in " + << backCoolLog.name() << " at (" + << cms::convert2mm(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick) + << "," << cms::convert2mm(backCool.barWidth / 2. + backCoolTank.width / 2.) + << ",0) with no rotation"; +#endif + } + + string bTankWaName(backCoolTank.waName + std::to_string(iMod + 1)); + Solid backCoolTankWaSolid = Box(bTankWaName, + backCoolTankHeight / 2. - backCoolTank.thick / 2., + backCoolTank.waWidth / 2., + halfZTank - backCoolTank.thick / 2.); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << bTankWaName << " Box " + << cms::convert2mm(backCoolTankHeight / 2. - backCoolTank.thick / 2.) << ":" + << cms::convert2mm(backCoolTank.waWidth / 2.) << ":" + << cms::convert2mm(halfZTank - backCoolTank.thick / 2.); +#endif + Volume backCoolTankWaLog = Volume(bTankWaName, backCoolTankWaSolid, ns.material(backCoolTank.waMat)); + backCoolTankLog.placeVolume(backCoolTankWaLog, copyOne, Transform3D(Rotation3D(), Position(0, 0, 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolTankWaLog.name() << ":" << copyOne << " positioned in " + << backCoolTankLog.name() << " at (0,0,0) with no rotation"; +#endif + + string bBracketName(backCoolTank.backBracketName + std::to_string(iMod + 1)); + Solid backBracketSolid = + Box(bBracketName, backCoolTank.backBracketHeight / 2., backCoolTank.width / 2., halfZTank); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << bBracketName << " Box " << cms::convert2mm(backCoolTank.backBracketHeight / 2.) + << ":" << cms::convert2mm(backCoolTank.width / 2.) << ":" + << cms::convert2mm(halfZTank); +#endif + Volume backBracketLog = Volume(bBracketName, backBracketSolid, ns.material(backCoolTank.backBracketMat)); + if (0 != backCoolTank.here) { + backCoolLog.placeVolume(backBracketLog, + copyOne, + Transform3D(Rotation3D(), + Position(backCool.barHeight - backCoolHeight / 2. - + backCoolTank.backBracketHeight / 2. + bottomThick, + -backCool.barWidth / 2. - backCoolTank.width / 2., + 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backBracketLog.name() << ":" << copyOne << " positioned in " + << backCoolLog.name() << " at (" + << cms::convert2mm(backCool.barHeight - backCoolHeight / 2. - + backCoolTank.backBracketHeight / 2. + bottomThick) + << "," << cms::convert2mm(-backCool.barWidth / 2. - backCoolTank.width / 2.) + << ",0) with no rotation"; +#endif + } + //=== + + Position bSumTra(backCool.barHeight - backCoolHeight / 2. + bottomThick, 0, 0); + for (unsigned int j(0); j != nMisc; ++j) { // loop over miscellaneous layers + Solid bSolid = Box(backMisc.vecName[iMod * nMisc + j], + backMisc.vecThick[iMod * nMisc + j] / 2, + backCool.barWidth / 2. + backCoolTank.width, + halfZBCool); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << backMisc.vecName[iMod * nMisc + j] << " Box " + << cms::convert2mm(backMisc.vecThick[iMod * nMisc + j] / 2) << ":" + << cms::convert2mm(backCool.barWidth / 2. + backCoolTank.width) << ":" + << cms::convert2mm(halfZBCool); +#endif + + Volume bLog = + Volume(backMisc.vecName[iMod * nMisc + j], bSolid, ns.material(backMisc.vecMat[iMod * nMisc + j])); + + const Position bTra(backMisc.vecThick[iMod * nMisc + j] / 2, 0, 0); + + if (0 != backMisc.here) { + backCoolLog.placeVolume(bLog, copyOne, Transform3D(Rotation3D(), bSumTra + bTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << bLog.name() << ":" << copyOne << " positioned in " << backCoolLog.name() + << " at (" << cms::convert2mm((bSumTra + bTra).x()) << "," + << cms::convert2mm((bSumTra + bTra).y()) << "," + << cms::convert2mm((bSumTra + bTra).z()) << ") with no rotation"; +#endif + } + + bSumTra += 2 * bTra; + } + + const double bHalfWidth(backCool.barWidth / 2. + backCoolTank.width); + + if (0 != mbLyr.here) { + Position mTra(-backCoolHeight / 2. + mbCoolTube.outDiam, 0, 0); + for (unsigned int j(0); j != mbLyr.vecMBLyrThick.size(); ++j) // loop over MB layers + { + Solid mSolid = Box(mbLyr.vecMBLyrThick[j] / 2, bHalfWidth, halfZBCool); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << (mbLyr.vecMBLyrName[j] + "_" + std::to_string(iMod + 1)) << " Box " + << cms::convert2mm(mbLyr.vecMBLyrThick[j] / 2) << ":" + << cms::convert2mm(bHalfWidth) << ":" << cms::convert2mm(halfZBCool); +#endif + Volume mLog = Volume( + mbLyr.vecMBLyrName[j] + "_" + std::to_string(iMod + 1), mSolid, ns.material(mbLyr.vecMBLyrMat[j])); + + mTra += Position(mbLyr.vecMBLyrThick[j] / 2.0, 0, 0); + backCoolLog.placeVolume(mLog, copyOne, Transform3D(Rotation3D(), mTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << mLog.name() << ":" << copyOne << " positioned in " << backCoolLog.name() + << " at (" << cms::convert2mm(mTra.x()) << "," << cms::convert2mm(mTra.y()) + << "," << cms::convert2mm(mTra.z()) << ") with no rotation"; +#endif + mTra += Position(mbLyr.vecMBLyrThick[j] / 2.0, 0, 0); + } + } + + if (0 != mbCoolTube.here) { + const string mBName(mbCoolTube.name + "_" + std::to_string(iMod + 1)); + + Solid mBCoolTubeSolid = Tube(0, mbCoolTube.outDiam / 2, halfZBCool, 0_deg, 360_deg); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << mBName << " Tubs " << cms::convert2mm(halfZBCool) + << ":0:" << cms::convert2mm(mbCoolTube.outDiam / 2) << ":0:360"; +#endif + Volume mBLog = Volume(mBName, mBCoolTubeSolid, ns.material(mbCoolTube.mat)); + + const string mBWaName(mbCoolTube.name + "Wa_" + std::to_string(iMod + 1)); + Solid mBCoolTubeWaSolid = Tube(mBWaName, 0, mbCoolTube.innDiam / 2, halfZBCool, 0_deg, 360_deg); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << mBWaName << " Tubs " << cms::convert2mm(halfZBCool) + << ":0:" << cms::convert2mm(mbCoolTube.innDiam / 2) << ":0:360"; +#endif + Volume mBWaLog = Volume(mBWaName, mBCoolTubeWaSolid, ns.material(backPipe.waterMat)); + mBLog.placeVolume(mBWaLog, copyOne); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << mBWaLog.name() << ":" << copyOne << " positioned in " << mBLog.name() + << " at (0,0,0) with no rotation"; +#endif + + for (unsigned int j(0); j != dryAirTube.mbCoolTubeNum; ++j) // loop over all MB cooling circuits + { + backCoolLog.placeVolume(mBLog, + 2 * j + 1, + Transform3D(Rotation3D(), + Position(-backCoolHeight / 2.0 + mbCoolTube.outDiam / 2., + -bHalfWidth + (j + 1) * bHalfWidth / 5, + 0))); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << mBLog.name() << ":" << (2 * j + 1) << " positioned in " << backCoolLog.name() + << " at (" << cms::convert2mm(-backCoolHeight / 2.0 + mbCoolTube.outDiam / 2.) + << "," << cms::convert2mm(-bHalfWidth + (j + 1) * bHalfWidth / 5) + << ",0) with no rotation"; +#endif + } + } + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Back Water Pipes !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + if (0 != backPipe.here && 0 != iMod) { + string bPipeName(backPipe.name + "_" + std::to_string(iMod + 1)); + string bInnerName(backPipe.name + "_H2O_" + std::to_string(iMod + 1)); + + Solid backPipeSolid = Tube(bPipeName, 0, backPipe.vecDiam[iMod] / 2, pipeLength / 2, 0_deg, 360_deg); + Solid backInnerSolid = + Tube(bInnerName, 0, backPipe.vecDiam[iMod] / 2 - backPipe.vecThick[iMod], pipeLength / 2, 0_deg, 360_deg); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << bPipeName << " Tubs " << cms::convert2mm(pipeLength / 2) + << ":0:" << cms::convert2mm(backPipe.vecDiam[iMod] / 2) << ":0:360"; + edm::LogVerbatim("EBGeom") << bInnerName << " Tubs " << cms::convert2mm(pipeLength / 2) + << ":0:" << cms::convert2mm(backPipe.vecDiam[iMod] / 2 - backPipe.vecThick[iMod]) + << ":0:360"; +#endif + + Volume backPipeLog = Volume(bPipeName, backPipeSolid, ns.material(backPipe.mat)); + Volume backInnerLog = Volume(bInnerName, backInnerSolid, ns.material(backPipe.waterMat)); + + const Position bPipeTra1(back.xOff + back.sideHeight - 0.7 * backPipe.vecDiam[iMod], + back.yOff + back.plateWidth / 2 - back.sideWidth - 0.7 * backPipe.vecDiam[iMod], + pipeZPos); + + spmLog.placeVolume(backPipeLog, copyOne, Transform3D(Rotation3D(), bPipeTra1)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backPipeLog.name() << ":" << copyOne << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm(bPipeTra1.x()) << "," + << cms::convert2mm(bPipeTra1.y()) << "," << cms::convert2mm(bPipeTra1.z()) + << ") with no rotation"; +#endif + const Position bPipeTra2( + bPipeTra1.x(), back.yOff - back.plateWidth / 2 + back.sideWidth + backPipe.vecDiam[iMod], bPipeTra1.z()); + + spmLog.placeVolume(backPipeLog, copyTwo, Transform3D(Rotation3D(), bPipeTra2)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backPipeLog.name() << ":" << copyTwo << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm(bPipeTra2.x()) << "," + << cms::convert2mm(bPipeTra2.y()) << "," << cms::convert2mm(bPipeTra2.z()) + << ") with no rotation"; +#endif + + backPipeLog.placeVolume(backInnerLog, copyOne, Transform3D(Rotation3D(), Position())); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backInnerLog.name() << ":" << copyOne << " positioned in " + << backPipeLog.name() << " at (0,0,0) with no rotation"; +#endif + } + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Back Water Pipes !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //================================================= + + if (0 != dryAirTube.here) { + string dryAirTubName(dryAirTube.name + std::to_string(iMod + 1)); + + Solid dryAirTubeSolid = + Tube(dryAirTubName, dryAirTube.innDiam / 2, dryAirTube.outDiam / 2, pipeLength / 2, 0_deg, 360_deg); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << dryAirTubName << " Tubs " << cms::convert2mm(pipeLength / 2) << ":" + << cms::convert2mm(dryAirTube.innDiam / 2) << ":" + << cms::convert2mm(dryAirTube.outDiam / 2) << ":0:360"; +#endif + Volume dryAirTubeLog = Volume((myns + dryAirTubName), dryAirTubeSolid, ns.material(dryAirTube.mat)); + + const Position dryAirTubeTra1(back.xOff + back.sideHeight - 0.7 * dryAirTube.outDiam - backPipe.vecDiam[iMod], + back.yOff + back.plateWidth / 2 - back.sideWidth - 1.2 * dryAirTube.outDiam, + pipeZPos); + + spmLog.placeVolume(dryAirTubeLog, copyOne, Transform3D(Rotation3D(), dryAirTubeTra1)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << dryAirTubeLog.name() << ":" << copyOne << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm(dryAirTubeTra1.x()) << "," + << cms::convert2mm(dryAirTubeTra1.y()) << "," + << cms::convert2mm(dryAirTubeTra1.z()) << ") with no rotation"; +#endif + + const Position dryAirTubeTra2(dryAirTubeTra1.x(), + back.yOff - back.plateWidth / 2 + back.sideWidth + 0.7 * dryAirTube.outDiam, + dryAirTubeTra1.z()); + + spmLog.placeVolume(dryAirTubeLog, copyTwo, Transform3D(Rotation3D(), dryAirTubeTra2)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << dryAirTubeLog.name() << ":" << copyTwo << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm(dryAirTubeTra2.x()) << "," + << cms::convert2mm(dryAirTubeTra2.y()) << "," + << cms::convert2mm(dryAirTubeTra2.z()) << ") with no rotation"; +#endif + } + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!!!!!!!!!!!!! Begin Placement of Cooling + VFE Cards !!!!!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + Position cTra(backCool.barHeight / 2. - backCoolHeight / 2. + bottomThick, 0, -halfZTank + halfZCoolVFE); + const unsigned int numSec(static_cast(backCool.vecBackCoolNSec[iMod])); + for (unsigned int jSec(0); jSec != numSec; ++jSec) { + const unsigned int nMax(static_cast(backCool.vecBackCoolNPerSec[iNSec++])); + for (unsigned int iBar(0); iBar != nMax; ++iBar) { + backCoolLog.placeVolume(backCoolVFELog, iCVFECopy++, cTra); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << backCoolVFELog.name() << ":" << iCVFECopy << " positioned in " + << backCoolLog.name() << " at (" << cms::convert2mm(cTra.x()) << "," + << cms::convert2mm(cTra.y()) << "," << cms::convert2mm(cTra.z()) + << ") with no rotation"; +#endif + cTra += Position(0, 0, backMisc.backCBStdSep); + } + cTra -= Position(0, 0, backMisc.backCBStdSep); // backspace to previous + if (jSec != numSec - 1) + cTra += Position(0, 0, backCool.vecBackCoolSecSep[iSep++]); // now take atypical step + } + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Placement of Cooling + VFE Cards !!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + } + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Placement of Readout & Cooling by Module !!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Patch Panel !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + double patchHeight(0); + for (unsigned int iPatch(0); iPatch != patchPanel.vecThick.size(); ++iPatch) { + patchHeight += patchPanel.vecThick[iPatch]; + } + + array patchParms{ + {patchHeight / 2., backCool.barWidth / 2., (spm.vecZPts.back() - grille.vecZOff.back() - grille.thick) / 2}}; + Solid patchSolid = Box(patchParms[0], patchParms[1], patchParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << patchPanel.name << " Box " << cms::convert2mm(patchParms[0]) << ":" + << cms::convert2mm(patchParms[1]) << ":" << cms::convert2mm(patchParms[2]); +#endif + Volume patchLog = Volume(patchPanel.name, patchSolid, ns.material(spm.mat)); + + const Position patchTra(back.xOff + 4 * dd4hep::mm, 0, grille.vecZOff.back() + grille.thick + patchParms[2]); + if (0 != patchPanel.here) { + spmLog.placeVolume(patchLog, copyOne, patchTra); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << patchLog.name() << ":" << copyOne << " positioned in " << spmLog.name() + << " at (" << cms::convert2mm(patchTra.x()) << "," << cms::convert2mm(patchTra.y()) + << "," << cms::convert2mm(patchTra.z()) << ") with no rotation"; +#endif + } + + Position pTra(-patchParms[0], 0, 0); + + for (unsigned int j(0); j != patchPanel.vecNames.size(); ++j) { + Solid pSolid = Box(patchPanel.vecThick[j] / 2., patchParms[1], patchParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << patchPanel.vecNames[j] << " Box " << cms::convert2mm(patchPanel.vecThick[j] / 2.) + << ":" << cms::convert2mm(patchParms[1]) << ":" << cms::convert2mm(patchParms[2]); +#endif + Volume pLog = Volume(patchPanel.vecNames[j], pSolid, ns.material(patchPanel.vecMat[j])); + + pTra += Position(patchPanel.vecThick[j] / 2, 0, 0); + patchLog.placeVolume(pLog, copyOne, pTra); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << pLog.name() << ":" << copyOne << " positioned in " << patchLog.name() << " at (" + << cms::convert2mm(pTra.x()) << "," << cms::convert2mm(pTra.y()) << "," + << cms::convert2mm(pTra.z()) << ") with no rotation"; +#endif + + pTra += Position(patchPanel.vecThick[j] / 2, 0, 0); + } + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Patch Panel !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! Begin Pincers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if (0 != pincer.rodHere) { + // Make hierarchy of rods, envelopes, blocks, shims, and cutouts + + Solid rodSolid = Box(pincer.rodName, pincer.envWidthHalf, pincer.envHeightHalf, ilyLengthHalf); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pincer.rodName << " Box " << cms::convert2mm(pincer.envWidthHalf) << ":" + << cms::convert2mm(pincer.envHeightHalf) << ":" << cms::convert2mm(ilyLengthHalf); +#endif + Volume rodLog = Volume(pincer.rodName, rodSolid, ns.material(pincer.rodMat)); + + array envParms{{pincer.envWidthHalf, pincer.envHeightHalf, pincer.envLengthHalf}}; + Solid envSolid = Box(pincer.envName, envParms[0], envParms[1], envParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pincer.envName << " Box " << cms::convert2mm(envParms[0]) << ":" + << cms::convert2mm(envParms[1]) << ":" << cms::convert2mm(envParms[2]); +#endif + Volume envLog = Volume(pincer.envName, envSolid, ns.material(pincer.envMat)); + + array blkParms{{pincer.envWidthHalf, pincer.envHeightHalf, pincer.blkLengthHalf}}; + Solid blkSolid = Box(pincer.blkName, blkParms[0], blkParms[1], blkParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pincer.blkName << " Box " << cms::convert2mm(blkParms[0]) << ":" + << cms::convert2mm(blkParms[1]) << ":" << cms::convert2mm(blkParms[2]); +#endif + Volume blkLog = Volume(pincer.blkName, blkSolid, ns.material(pincer.blkMat)); + + envLog.placeVolume(blkLog, copyOne, Position(0, 0, pincer.envLengthHalf - pincer.blkLengthHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << blkLog.name() << ":" << copyOne << " positioned in " << envLog.name() + << " at (0,0," << cms::convert2mm(pincer.envLengthHalf - pincer.blkLengthHalf) + << ") with no rotation"; +#endif + + array cutParms{{pincer.cutWidth / 2., pincer.cutHeight / 2., pincer.blkLengthHalf}}; + Solid cutSolid = Box(pincer.cutName, cutParms[0], cutParms[1], cutParms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pincer.cutName << " Box " << cms::convert2mm(cutParms[0]) << ":" + << cms::convert2mm(cutParms[1]) << ":" << cms::convert2mm(cutParms[2]); +#endif + Volume cutLog = Volume(pincer.cutName, cutSolid, ns.material(pincer.cutMat)); + blkLog.placeVolume( + cutLog, + copyOne, + Position( + +blkParms[0] - cutParms[0] - pincer.shim1Width + pincer.shim2Width, -blkParms[1] + cutParms[1], 0)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << cutLog.name() << ":" << copyOne << " positioned in " << blkLog.name() << " at (" + << cms::convert2mm(+blkParms[0] - cutParms[0] - pincer.shim1Width + + pincer.shim2Width) + << "," << cms::convert2mm(-blkParms[1] + cutParms[1]) << ",0) with no rotation"; +#endif + array shim2Parms{{pincer.shim2Width / 2., pincer.shimHeight / 2., pincer.blkLengthHalf}}; + Solid shim2Solid = Box(pincer.shim2Name, shim2Parms[0], shim2Parms[1], shim2Parms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pincer.shim2Name << " Box " << cms::convert2mm(shim2Parms[0]) << ":" + << cms::convert2mm(shim2Parms[1]) << ":" << cms::convert2mm(shim2Parms[2]); +#endif + Volume shim2Log = Volume(pincer.shim2Name, shim2Solid, ns.material(pincer.shimMat)); + cutLog.placeVolume(shim2Log, copyOne, Position(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << shim2Log.name() << ":" << copyOne << " positioned in " << cutLog.name() + << " at (" << cms::convert2mm(cutParms[0] - shim2Parms[0]) << "," + << cms::convert2mm(-cutParms[1] + shim2Parms[1]) << ",0) with no rotation"; +#endif + + array shim1Parms{ + {pincer.shim1Width / 2., pincer.shimHeight / 2., pincer.envLengthHalf - pincer.blkLengthHalf}}; + Solid shim1Solid = Box(pincer.shim1Name, shim1Parms[0], shim1Parms[1], shim1Parms[2]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeom") << pincer.shim1Name << " Box " << cms::convert2mm(shim1Parms[0]) << ":" + << cms::convert2mm(shim1Parms[1]) << ":" << cms::convert2mm(shim1Parms[2]); +#endif + Volume shim1Log = Volume(pincer.shim1Name, shim1Solid, ns.material(pincer.shimMat)); + envLog.placeVolume( + shim1Log, + copyOne, + Position(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2])); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << shim1Log.name() << ":" << copyOne << " positioned in " << envLog.name() + << " at (" << cms::convert2mm(envParms[0] - shim1Parms[0]) << "," + << cms::convert2mm(-envParms[1] + shim1Parms[1]) << "," + << cms::convert2mm(-envParms[2] + shim1Parms[2]) << ") with no rotation"; +#endif + + for (unsigned int iEnv(0); iEnv != pincer.vecEnvZOff.size(); ++iEnv) { + rodLog.placeVolume( + envLog, 1 + iEnv, Position(0, 0, -ilyLengthHalf + pincer.vecEnvZOff[iEnv] - pincer.envLengthHalf)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << envLog.name() << ":" << (1 + iEnv) << " positioned in " << rodLog.name() + << " at (0,0," + << cms::convert2mm(-ilyLengthHalf + pincer.vecEnvZOff[iEnv] - + pincer.envLengthHalf) + << ") with no rotation"; +#endif + } + + // Place the rods + const double radius(ilyRMin - pincer.envHeightHalf - 1 * dd4hep::mm); + const string xilyName(ily.name + std::to_string(ily.vecIlyMat.size() - 1)); + + for (unsigned int iRod(0); iRod != pincer.vecRodAzimuth.size(); ++iRod) { + const Position rodTra(radius * cos(pincer.vecRodAzimuth[iRod]), radius * sin(pincer.vecRodAzimuth[iRod]), 0); + xilyLog.placeVolume(rodLog, + 1 + iRod, + Transform3D(myrot(ns, + pincer.rodName + std::to_string(iRod), + CLHEP::HepRotationZ(90_deg + pincer.vecRodAzimuth[iRod])), + rodTra)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EBGeomX") << rodLog.name() << ":" << (1 + iRod) << " positioned in " << xilyLog.name() + << " at (" << cms::convert2mm(rodTra.x()) << "," << cms::convert2mm(rodTra.y()) + << "," << cms::convert2mm(rodTra.z()) << ") with rotation"; +#endif + } + } + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!! End Pincers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + } + } + + return 1; +} + +DECLARE_DDCMS_DETELEMENT(DDCMS_ecal_DDEcalBarrelNewAlgoSubtraction, algorithm) diff --git a/Geometry/EcalCommonData/src/EcalBarrelNumberingScheme.cc b/Geometry/EcalCommonData/src/EcalBarrelNumberingScheme.cc index 1ad4b4d32e394..922a6fd7b2a78 100644 --- a/Geometry/EcalCommonData/src/EcalBarrelNumberingScheme.cc +++ b/Geometry/EcalCommonData/src/EcalBarrelNumberingScheme.cc @@ -4,6 +4,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" +#include //#define EDM_ML_DEBUG @@ -19,9 +20,12 @@ uint32_t EcalBarrelNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const uint32_t nLevels(baseNumber.getLevels()); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EcalGeom") << "ECalBarrelNumberingScheme geometry levels = " << nLevels; + std::ostringstream st1; + for (uint32_t k = 0; k < nLevels; ++k) + st1 << ", " << baseNumber.getLevelName(k) << ":" << baseNumber.getCopyNumber(k); + edm::LogVerbatim("EcalGeom") << "ECalBarrelNumberingScheme geometry levels = " << nLevels << st1.str(); #endif - if (12 > nLevels) { + if (11 > nLevels) { edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " << "Not enough levels found in EcalBaseNumber ( " << nLevels << ") Returning 0"; return 0; @@ -31,25 +35,25 @@ uint32_t EcalBarrelNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const int cryType(::atoi(cryName.c_str() + 5)); + uint32_t wallCopy(0), hawCopy(0), fawCopy(0), supmCopy(0); const int off(13 < nLevels ? 3 : 0); - const uint32_t wallCopy(baseNumber.getCopyNumber(3 + off)); - const uint32_t hawCopy(baseNumber.getCopyNumber(4 + off)); - const uint32_t fawCopy(baseNumber.getCopyNumber(5 + off)); - const uint32_t supmCopy(baseNumber.getCopyNumber(6 + off)); + if ((nLevels != 11) && (nLevels != 14)) { + wallCopy = baseNumber.getCopyNumber(3 + off); + hawCopy = baseNumber.getCopyNumber(4 + off); + fawCopy = baseNumber.getCopyNumber(5 + off); + supmCopy = baseNumber.getCopyNumber(6 + off); + } else { + auto num1 = numbers(baseNumber.getLevelName(3 + off)); + wallCopy = num1.second; + hawCopy = num1.first; + auto num2 = numbers(baseNumber.getLevelName(4 + off)); + fawCopy = num2.second; + supmCopy = num2.first; + } #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EcalGeom") << nLevels << ", " << off << ", " << cryType << ", " << baseNumber.getLevelName(0) << ":" - << baseNumber.getCopyNumber(0) << ", " << baseNumber.getLevelName(1) << ":" - << baseNumber.getCopyNumber(1) << ", " << baseNumber.getLevelName(2) << ":" - << baseNumber.getCopyNumber(2) << ", " << baseNumber.getLevelName(3) << ":" - << baseNumber.getCopyNumber(3) << ", " << baseNumber.getLevelName(4) << ":" - << baseNumber.getCopyNumber(4) << ", " << baseNumber.getLevelName(5) << ":" - << baseNumber.getCopyNumber(5) << ", " << baseNumber.getLevelName(6) << ":" - << baseNumber.getCopyNumber(6) << ", " << baseNumber.getLevelName(7) << ":" - << baseNumber.getCopyNumber(7) << ", " << baseNumber.getLevelName(8) << ":" - << baseNumber.getCopyNumber(8) << ", " << baseNumber.getLevelName(9) << ":" - << baseNumber.getCopyNumber(9) << ", " << baseNumber.getLevelName(10) << ":" - << baseNumber.getCopyNumber(10); + edm::LogVerbatim("EcalGeom") << nLevels << " off: " << off << " cryType: " << cryType << " wallCopy: " << wallCopy + << " hawCopy: " << hawCopy << " fawCopy: " << fawCopy << " supmCopy: " << supmCopy; #endif // error checking @@ -117,3 +121,23 @@ uint32_t EcalBarrelNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) #endif return intindex; } + +std::pair EcalBarrelNumberingScheme::numbers(const std::string& name) const { + int num1(-1), num2(-1); + if (name.find('#') != std::string::npos) { + uint32_t ip1 = name.find('#'); + if (name.find('!') != std::string::npos) { + uint32_t ip2 = name.find('!'); + num1 = ::atoi(name.substr(ip1 + 1, ip2 - ip1 - 1).c_str()); + if (name.find('#', ip2) != std::string::npos) { + uint32_t ip3 = name.find('#', ip2); + num2 = ::atoi(name.substr(ip3 + 1, name.size() - ip3 - 1).c_str()); + } + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "EcalBarrelNumberingScheme::Numbers from " << name << " are " << num1 << " and " + << num2; +#endif + return std::make_pair(num1, num2); +} diff --git a/Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml b/Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml new file mode 100644 index 0000000000000..5128aede4e667 --- /dev/null +++ b/Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/ForwardCommonData/data/hfnose/v0/hfnose.xml b/Geometry/ForwardCommonData/data/hfnose/v0/hfnose.xml index d45d232d1dfc3..0285dd95511c8 100644 --- a/Geometry/ForwardCommonData/data/hfnose/v0/hfnose.xml +++ b/Geometry/ForwardCommonData/data/hfnose/v0/hfnose.xml @@ -111,6 +111,7 @@ 0, 0, 0, 0, 0, 0, 0, 0 + diff --git a/Geometry/ForwardCommonData/data/hfnose/v1/hfnose.xml b/Geometry/ForwardCommonData/data/hfnose/v1/hfnose.xml index 379d44ea0c3e0..869773934d4f2 100644 --- a/Geometry/ForwardCommonData/data/hfnose/v1/hfnose.xml +++ b/Geometry/ForwardCommonData/data/hfnose/v1/hfnose.xml @@ -178,6 +178,7 @@ 0, 0, 0, 0, 0, 0, 0, 0 + diff --git a/Geometry/ForwardCommonData/data/hfnose/v2/hfnose.xml b/Geometry/ForwardCommonData/data/hfnose/v2/hfnose.xml index 83a89494f1782..7811da3033853 100644 --- a/Geometry/ForwardCommonData/data/hfnose/v2/hfnose.xml +++ b/Geometry/ForwardCommonData/data/hfnose/v2/hfnose.xml @@ -178,6 +178,7 @@ 0, 0, 0, 0, 0, 0, 0, 0 + diff --git a/Geometry/ForwardCommonData/python/hfnoseAloneXML_cfi.py b/Geometry/ForwardCommonData/python/hfnoseAloneXML_cfi.py index c14fa6f9a9a83..89a8714e3d9be 100644 --- a/Geometry/ForwardCommonData/python/hfnoseAloneXML_cfi.py +++ b/Geometry/ForwardCommonData/python/hfnoseAloneXML_cfi.py @@ -5,14 +5,16 @@ 'Geometry/CMSCommonData/data/materials.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2026/v1/cms.xml', 'Geometry/CMSCommonData/data/cavernData/2017/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/caloBase/2026/v5/caloBase.xml', 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/ForwardCommonData/data/hfnose/v0/hfnose.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/ForwardCommonData/data/hfnose/v4/hfnose.xml', + 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml', 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnoseWafer.xml', - 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml'), + 'Geometry/ForwardCommonData/data/hfnoseLayer/v2/hfnoseLayer.xml'), rootNodeName = cms.string('cms:OCMS') ) diff --git a/Geometry/ForwardCommonData/python/hfnoseWaferXML_cfi.py b/Geometry/ForwardCommonData/python/hfnoseWaferXML_cfi.py index 3ad562475e4c3..010b9fe1e15b3 100644 --- a/Geometry/ForwardCommonData/python/hfnoseWaferXML_cfi.py +++ b/Geometry/ForwardCommonData/python/hfnoseWaferXML_cfi.py @@ -5,7 +5,7 @@ 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/HGCalCommonData/test/cms.xml', 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnose.xml', - 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnoseWafer.xml', - 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml'), + 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml', + 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnoseWafer.xml'), rootNodeName = cms.string('cms:OCMS') ) diff --git a/Geometry/ForwardCommonData/python/hfnoseXML_cfi.py b/Geometry/ForwardCommonData/python/hfnoseXML_cfi.py index 2114a5440b5f8..94af688fb8265 100644 --- a/Geometry/ForwardCommonData/python/hfnoseXML_cfi.py +++ b/Geometry/ForwardCommonData/python/hfnoseXML_cfi.py @@ -5,13 +5,14 @@ 'Geometry/CMSCommonData/data/materials.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2026/v1/cms.xml', 'Geometry/CMSCommonData/data/cavernData/2017/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/caloBase/2026/v5/caloBase.xml', 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/ForwardCommonData/data/forwardshield/2026/v1/forwardshield.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', 'Geometry/ForwardCommonData/data/hfnose/v1/hfnose.xml', 'Geometry/ForwardCommonData/data/hfnoseWafer/v1/hfnoseWafer.xml', 'Geometry/ForwardCommonData/data/hfnoseCell/v1/hfnoseCell.xml', diff --git a/Geometry/ForwardCommonData/python/testHFNoseXML_cfi.py b/Geometry/ForwardCommonData/python/testHFNoseXML_cfi.py index e7e044c096c0a..11f6c2589caf0 100644 --- a/Geometry/ForwardCommonData/python/testHFNoseXML_cfi.py +++ b/Geometry/ForwardCommonData/python/testHFNoseXML_cfi.py @@ -1,8 +1,5 @@ import FWCore.ParameterSet.Config as cms -# This config was generated automatically using generate2026Geometry.py -# If you notice a mistake, please update the generating script, not just this config - XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", geomXMLFiles = cms.vstring( 'Geometry/CMSCommonData/data/materials.xml', diff --git a/Geometry/ForwardCommonData/test/dumpHFNoseCell_cfg.py b/Geometry/ForwardCommonData/test/dumpHFNoseCell_cfg.py new file mode 100644 index 0000000000000..a88dd67f457a5 --- /dev/null +++ b/Geometry/ForwardCommonData/test/dumpHFNoseCell_cfg.py @@ -0,0 +1,26 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("DUMP") +process.load("Geometry.ForwardCommonData.hfnoseCellXML_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.G4cerr=dict() + process.MessageLogger.G4cout=dict() + process.MessageLogger.HGCalGeom=dict() + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.add_(cms.ESProducer("TGeoMgrFromDdd", + verbose = cms.untracked.bool(False), + level = cms.untracked.int32(14) +)) + +process.dump = cms.EDAnalyzer("DumpSimGeometry", + outputFileName = cms.untracked.string('hfnoseCell.root')) + +process.p = cms.Path(process.dump) diff --git a/Geometry/ForwardCommonData/test/dumpHFNoseWafer_cfg.py b/Geometry/ForwardCommonData/test/dumpHFNoseWafer_cfg.py new file mode 100644 index 0000000000000..56816b2947c73 --- /dev/null +++ b/Geometry/ForwardCommonData/test/dumpHFNoseWafer_cfg.py @@ -0,0 +1,26 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("DUMP") +process.load("Geometry.ForwardCommonData.hfnoseWaferXML_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.G4cerr=dict() + process.MessageLogger.G4cout=dict() + process.MessageLogger.HGCalGeom=dict() + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.add_(cms.ESProducer("TGeoMgrFromDdd", + verbose = cms.untracked.bool(False), + level = cms.untracked.int32(14) +)) + +process.dump = cms.EDAnalyzer("DumpSimGeometry", + outputFileName = cms.untracked.string('hfnoseWafer.root')) + +process.p = cms.Path(process.dump) diff --git a/Geometry/ForwardCommonData/test/testHFNoseParameters_cfg.py b/Geometry/ForwardCommonData/test/testHFNoseParameters_cfg.py index fa22239cef670..2f688fbdc83fd 100644 --- a/Geometry/ForwardCommonData/test/testHFNoseParameters_cfg.py +++ b/Geometry/ForwardCommonData/test/testHFNoseParameters_cfg.py @@ -34,8 +34,8 @@ ) process.testNose = cms.EDAnalyzer("HGCalParameterTester", - Name = cms.untracked.string("HGCalHFNoseSensitive"), - Mode = cms.untracked.int32(1) + Name = cms.string("HGCalHFNoseSensitive"), + Mode = cms.int32(1) ) process.p1 = cms.Path(process.generator*process.testNose) diff --git a/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalWafer8-algorithm.xml b/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalWafer8-algorithm.xml new file mode 100644 index 0000000000000..a2b99a7472e44 --- /dev/null +++ b/Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalWafer8-algorithm.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalCell.cc b/Geometry/HGCalCommonData/plugins/DDHGCalCell.cc index 38e01eaa6c426..c0f44143da4a5 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalCell.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalCell.cc @@ -18,8 +18,7 @@ class DDHGCalCell : public DDAlgorithm { public: // Constructor and Destructor - DDHGCalCell(); - ~DDHGCalCell() override; + DDHGCalCell() {} void initialize(const DDNumericArguments& nArgs, const DDVectorArguments& vArgs, @@ -42,14 +41,6 @@ class DDHGCalCell : public DDAlgorithm { std::string nameSpace_; // Namespace to be used }; -DDHGCalCell::DDHGCalCell() { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Creating an instance"; -#endif -} - -DDHGCalCell::~DDHGCalCell() {} - void DDHGCalCell::initialize(const DDNumericArguments& nArgs, const DDVectorArguments&, const DDMapArguments&, @@ -84,7 +75,7 @@ void DDHGCalCell::initialize(const DDNumericArguments& nArgs, #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << waferSize_ << " T " << waferT_ << " Cell T " << cellT_ << " Cells/Wafer " << nCells_ << " Material " << material_ << "Sensitive Position " - << posSens_ << " NameSpace " << nameSpace_ << " Full Cell: " << fullCN_ << ":" + << posSens_ << " NameSpace " << nameSpace_ << ": Full Cell: " << fullCN_ << ":" << fullSensN_; for (unsigned int k = 0; k < truncCN_.size(); ++k) edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] " << truncCN_[k] << ":" @@ -97,14 +88,10 @@ void DDHGCalCell::initialize(const DDNumericArguments& nArgs, } void DDHGCalCell::execute(DDCompactView& cpv) { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalCell..."; -#endif - DDName matName(DDSplit(material_).first, DDSplit(material_).second); DDMaterial matter(matName); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName << " initialized at " << &matter; + edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName << " initialized"; #endif DDLogicalPart glog1, glog2; @@ -178,8 +165,8 @@ void DDHGCalCell::execute(DDCompactView& cpv) { glog2 = DDLogicalPart(solid.ddname(), matter, solid); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName - << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] - << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] + << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] + << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges"; for (unsigned int k = 0; k < xw.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k]; @@ -187,7 +174,7 @@ void DDHGCalCell::execute(DDCompactView& cpv) { cpv.position(glog2, glog1, 1, tran, rot); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() - << " at " << tran << " with " << rot; + << " at " << tran << " with no rotation"; #endif } @@ -213,8 +200,8 @@ void DDHGCalCell::execute(DDCompactView& cpv) { glog2 = DDLogicalPart(solid.ddname(), matter, solid); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName - << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] - << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] + << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] + << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges"; for (unsigned int k = 0; k < xw.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k]; @@ -222,7 +209,7 @@ void DDHGCalCell::execute(DDCompactView& cpv) { cpv.position(glog2, glog1, 1, tran, rot); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() - << " at " << tran << " with " << rot; + << " at " << tran << " with no rotation"; #endif } @@ -248,8 +235,8 @@ void DDHGCalCell::execute(DDCompactView& cpv) { glog2 = DDLogicalPart(solid.ddname(), matter, solid); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName - << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] - << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] + << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] + << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges"; for (unsigned int k = 0; k < xw.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k]; @@ -257,7 +244,7 @@ void DDHGCalCell::execute(DDCompactView& cpv) { cpv.position(glog2, glog1, 1, tran, rot); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() - << " at " << tran << " with " << rot; + << " at " << tran << " with no rotation"; #endif } } diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEFileAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalEEFileAlgo.cc index 3c1472fab82f5..ea365dde75317 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEFileAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEFileAlgo.cc @@ -194,7 +194,7 @@ void DDHGCalEEFileAlgo::initialize(const DDNumericArguments& nArgs, #endif nameSpace_ = DDCurrentNamespace::ns(); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: NameSpace " << nameSpace_; + edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: NameSpace " << nameSpace_ << ":"; #endif } @@ -220,9 +220,6 @@ void DDHGCalEEFileAlgo::execute(DDCompactView& cpv) { } void DDHGCalEEFileAlgo::constructLayers(const DDLogicalPart& module, DDCompactView& cpv) { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: \t\tInside Layers"; -#endif double zi(zMinBlock_); int laymin(0); for (unsigned int i = 0; i < layers_.size(); i++) { @@ -289,10 +286,10 @@ void DDHGCalEEFileAlgo::constructLayers(const DDLogicalPart& module, DDCompactVi DDSolid solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthick, rins, routs, 0.0, 2._pi); glog = DDLogicalPart(solid.ddname(), matter, solid); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: " << solid.name() << " Tubs made of " << matName << ":" - << &matter << " of dimensions " << rinB << ":" << rins << ", " << routF << ":" - << routs << ", " << hthick << ", 0.0, 360.0 and position " << glog.name() - << " number " << copy << ":" << layerCenter_[copy - firstLayer_]; + edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: " << solid.name() << " Tubs made of " << matName + << " of dimensions " << rinB << ":" << rins << ", " << routF << ":" << routs + << ", " << hthick << ", 0.0, 360.0 and position " << glog.name() << " number " + << copy << ":" << layerCenter_[copy - firstLayer_]; #endif positionSensitive(glog, rins, routs, zz, layerSense_[ly], (copy - firstLayer_), cpv); } diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEFileAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalHEFileAlgo.cc index 79855c0748031..ce58f61ab1a03 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEFileAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEFileAlgo.cc @@ -248,7 +248,7 @@ void DDHGCalHEFileAlgo::initialize(const DDNumericArguments& nArgs, #endif nameSpace_ = DDCurrentNamespace::ns(); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: NameSpace " << nameSpace_; + edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: NameSpace " << nameSpace_ << ":"; #endif } @@ -274,9 +274,6 @@ void DDHGCalHEFileAlgo::execute(DDCompactView& cpv) { } void DDHGCalHEFileAlgo::constructLayers(const DDLogicalPart& module, DDCompactView& cpv) { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: \t\tInside Layers"; -#endif double zi(zMinBlock_); int laymin(0); for (unsigned int i = 0; i < layers_.size(); i++) { diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalWafer8.cc b/Geometry/HGCalCommonData/plugins/DDHGCalWafer8.cc index 3e548f5c551b9..d14168404c213 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalWafer8.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalWafer8.cc @@ -19,8 +19,7 @@ class DDHGCalWafer8 : public DDAlgorithm { public: // Constructor and Destructor - DDHGCalWafer8(); - ~DDHGCalWafer8() override; + DDHGCalWafer8() {} void initialize(const DDNumericArguments& nArgs, const DDVectorArguments& vArgs, @@ -33,7 +32,6 @@ class DDHGCalWafer8 : public DDAlgorithm { double waferSize_; // Wafer size double waferT_; // Wafer thickness double waferSepar_; // Sensor separation - double mouseBite_; // MouseBite radius int nCells_; // Half number of cells along u-v axis int cellType_; // Cell Type (0,1,2: Fine, Course 2/3) std::string material_; // Material name for module with gap @@ -41,14 +39,6 @@ class DDHGCalWafer8 : public DDAlgorithm { std::string nameSpace_; // Namespace to be used }; -DDHGCalWafer8::DDHGCalWafer8() { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Creating an instance"; -#endif -} - -DDHGCalWafer8::~DDHGCalWafer8() {} - void DDHGCalWafer8::initialize(const DDNumericArguments& nArgs, const DDVectorArguments&, const DDMapArguments&, @@ -57,7 +47,6 @@ void DDHGCalWafer8::initialize(const DDNumericArguments& nArgs, waferSize_ = nArgs["WaferSize"]; waferT_ = nArgs["WaferThick"]; waferSepar_ = nArgs["SensorSeparation"]; - mouseBite_ = nArgs["MouseBite"]; nCells_ = (int)(nArgs["NCells"]); cellType_ = (int)(nArgs["CellType"]); material_ = sArgs["Material"]; @@ -65,20 +54,15 @@ void DDHGCalWafer8::initialize(const DDNumericArguments& nArgs, nameSpace_ = DDCurrentNamespace::ns(); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Wafer 2r " << waferSize_ << " T " << waferT_ << " Half Separation " - << waferSepar_ << " Mouse bite radius " << mouseBite_ << " Cells/Wafer " << nCells_ - << " Cell Type " << cellType_ << " Material " << material_ << " Names " - << parent().name() << " NameSpace " << nameSpace_ << " # of cells " - << cellNames_.size(); + << waferSepar_ << " Cells/Wafer " << nCells_ << " Cell Type " << cellType_ + << " Material " << material_ << " Names " << parent().name() << " NameSpace " + << nameSpace_ << ": # of cells " << cellNames_.size(); for (unsigned int k = 0; k < cellNames_.size(); ++k) edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Cell[" << k << "] " << cellNames_[k]; #endif } void DDHGCalWafer8::execute(DDCompactView& cpv) { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWafer8..."; -#endif - static const double sqrt3 = std::sqrt(3.0); double rM = 0.5 * (waferSize_ + waferSepar_); double RM2 = rM / sqrt3; @@ -102,12 +86,16 @@ void DDHGCalWafer8::execute(DDCompactView& cpv) { << " and " << xM.size() << " edges"; for (unsigned int k = 0; k < xM.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k]; + int counter(0); #endif DDRotation rot; for (int u = 0; u < 2 * nCells_; ++u) { for (int v = 0; v < 2 * nCells_; ++v) { if (((v - u) < nCells_) && (u - v) <= nCells_) { +#ifdef EDM_ML_DEBUG + counter++; +#endif int n2 = nCells_ / 2; double yp = (u - 0.5 * v - n2) * 2 * r; double xp = (1.5 * (v - nCells_) + 1.0) * R; @@ -146,6 +134,9 @@ void DDHGCalWafer8::execute(DDCompactView& cpv) { } } } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HGCalGeom") << "\nDDHGCalWafer8::Counter : " << counter << "\n===============================\n"; +#endif } DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDHGCalWafer8, "hgcal:DDHGCalWafer8"); diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalCell.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalCell.cc index 2a94abac48d61..f19512ba1f973 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalCell.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalCell.cc @@ -53,19 +53,18 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << cms::convert2mm(waferSize) << " T " << cms::convert2mm(waferT) << " Cell T " << cms::convert2mm(cellT) << " Cells/Wafer " << nCells << " Material " << material << "Sensitive Position " << posSens - << " Full Cell: " << fullCN << ":" << fullSensN; + << " NameSpace " << ns.name() << " Full Cell: " << fullCN << ":" << fullSensN; for (int k = 0; k < 3; ++k) edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] " << truncCN[k] << ":" << truncSensN[k]; for (int k = 0; k < 3; ++k) edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Extended Cell[" << k << "] " << extenCN[k] << ":" << extenSensN[k]; for (int k = 0; k < 6; ++k) edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Corner Cell[" << k << "] " << cornrCN[k] << ":" << cornrSensN[k]; - edm::LogVerbatim("HGCalGeom") << "Name space " << ns.name(); #endif dd4hep::Material matter = ns.material(material); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << material << " initialized at " << &matter; + edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << material << " initialized"; #endif dd4hep::Volume glog1, glog2; @@ -119,8 +118,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]); #endif - dd4hep::Rotation3D rotation; - glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran)); + glog1.placeVolume(glog2, 1, tran); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() << " at (0,0," << cms::convert2mm(zpos) << ") with no rotation"; @@ -155,14 +153,14 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext ns.addVolumeNS(glog2); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << material - << " z|x|y|s (0) " << cms::convert2mm(zw[0]) << ":" << cms::convert2mm(zx[0]) << ":" + << " z|x|y|s (0) " << cms::convert2mm(zc[0]) << ":" << cms::convert2mm(zx[0]) << ":" << cms::convert2mm(zy[0]) << ":" << scale[0] << " z|x|y|s (1) " - << cms::convert2mm(zw[1]) << ":" << cms::convert2mm(zx[1]) << ":" + << cms::convert2mm(zc[1]) << ":" << cms::convert2mm(zx[1]) << ":" << cms::convert2mm(zy[1]) << ":" << scale[1] << " and " << xw.size() << " edges"; for (unsigned int k = 0; k < xw.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]); #endif - glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran)); + glog1.placeVolume(glog2, 1, tran); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() << " at (0,0," << cms::convert2mm(zpos) << ") with no rotation"; @@ -196,17 +194,17 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext ns.addVolumeNS(glog2); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << material - << " z|x|y|s (0) " << cms::convert2mm(zw[0]) << ":" << cms::convert2mm(zx[0]) << ":" + << " z|x|y|s (0) " << cms::convert2mm(zc[0]) << ":" << cms::convert2mm(zx[0]) << ":" << cms::convert2mm(zy[0]) << ":" << scale[0] << " z|x|y|s (1) " - << cms::convert2mm(zw[1]) << ":" << cms::convert2mm(zx[1]) << ":" + << cms::convert2mm(zc[1]) << ":" << cms::convert2mm(zx[1]) << ":" << cms::convert2mm(zy[1]) << ":" << scale[1] << " and " << xw.size() << " edges"; for (unsigned int k = 0; k < xw.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]); #endif - glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran)); + glog1.placeVolume(glog2, 1, tran); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() - << " at (0,0," << cms::convert2mm(zpos) << " with no rotation"; + << " at (0,0," << cms::convert2mm(zpos) << ") with no rotation"; #endif } @@ -237,17 +235,17 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext ns.addVolumeNS(glog2); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << material - << " z|x|y|s (0) " << cms::convert2mm(zw[0]) << ":" << cms::convert2mm(zx[0]) << ":" + << " z|x|y|s (0) " << cms::convert2mm(zc[0]) << ":" << cms::convert2mm(zx[0]) << ":" << cms::convert2mm(zy[0]) << ":" << scale[0] << " z|x|y|s (1) " - << cms::convert2mm(zw[1]) << ":" << cms::convert2mm(zx[1]) << ":" + << cms::convert2mm(zc[1]) << ":" << cms::convert2mm(zx[1]) << ":" << cms::convert2mm(zy[1]) << ":" << scale[1] << " and " << xw.size() << " edges"; for (unsigned int k = 0; k < xw.size(); ++k) edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]); #endif - glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran)); + glog1.placeVolume(glog2, 1, tran); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() - << " at (0,0," << cms::convert2mm(zpos) << " with no rotation"; + << " at (0,0," << cms::convert2mm(zpos) << ") with no rotation"; #endif } return cms::s_executed; diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc index 7391cb5c74fbb..52ef2236c155f 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc @@ -483,8 +483,9 @@ struct HGCalHEFileAlgo { #ifdef EDM_ML_DEBUG int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0); std::vector ntype(6, 0); - edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " rout " << cms::convert2mm(rout) << " N " - << N << " for maximum u, v Offset; Shift " << cms::convert2mm(xyoff.first) << ":" + edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " rin:rout " << cms::convert2mm(rin) << ":" + << cms::convert2mm(rout) << " zpos " << cms::convert2mm(zpos) << " N " << N + << " for maximum u, v Offset; Shift " << cms::convert2mm(xyoff.first) << ":" << cms::convert2mm(xyoff.second) << " WaferSize " << cms::convert2mm((waferSize_ + waferSepar_)); #endif @@ -506,6 +507,8 @@ struct HGCalHEFileAlgo { int type = HGCalWaferType::getType(indx, waferIndex_, waferProperty_); if (corner.first > 0 && type >= 0) { int copy = HGCalTypes::packTypeUV(type, u, v); + if (layertype > 1) + type += 3; #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << " DDHGCalHEFileAlgo: " << waferNames_[type] << " number " << copy << " type " << type << " layer:u:v:indx " << (layer + firstLayer_) << ":" << u << ":" << v @@ -526,17 +529,14 @@ struct HGCalHEFileAlgo { ivmAll = iv; ++nin; #endif - dd4hep::Position tran(xpos, ypos, 0.0); - if (layertype > 1) - type += 3; glog.placeVolume(ns.volume(waferNames_[type]), copy, tran); - #ifdef EDM_ML_DEBUG ++ntype[type]; edm::LogVerbatim("HGCalGeom") - << "DDHGCalHEFileAlgo: " << glog.name() << " number " << copy << " positioned in " << glog.name() - << " at (" << cms::convert2mm(xpos) << ", " << cms::convert2mm(ypos) << ", 0) with no rotation"; + << "DDHGCalHEFileAlgo: " << waferNames_[type] << " number " << copy << " type " << layertype << ":" + << type << " positioned in " << glog.name() << " at (" << cms::convert2mm(xpos) << ", " + << cms::convert2mm(ypos) << ", 0) with no rotation"; #endif } } diff --git a/Geometry/HGCalCommonData/python/testHGCalWafer8XML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalWafer8XML_cfi.py index fe896fd23877c..f326c1fcec214 100644 --- a/Geometry/HGCalCommonData/python/testHGCalWafer8XML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalWafer8XML_cfi.py @@ -1,14 +1,15 @@ import FWCore.ParameterSet.Config as cms XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", - geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml', + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/HGCalCommonData/test/cms.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcal.xml', - 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalpos.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', - 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml'), - rootNodeName = cms.string('cms:OCMS') + 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalpos.xml'), + rootNodeName = cms.string('cms:OCMS') ) diff --git a/Geometry/HGCalCommonData/test/cms.xml b/Geometry/HGCalCommonData/test/cms.xml index b42537f44de7a..16cc2d0cd146a 100644 --- a/Geometry/HGCalCommonData/test/cms.xml +++ b/Geometry/HGCalCommonData/test/cms.xml @@ -15,6 +15,10 @@ + + + + diff --git a/Geometry/HGCalCommonData/test/python/runHGCalD76DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/runHGCalD76DD4Hep_cfg.py new file mode 100644 index 0000000000000..9123193fd2a26 --- /dev/null +++ b/Geometry/HGCalCommonData/test/python/runHGCalD76DD4Hep_cfg.py @@ -0,0 +1,151 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep + +process = cms.Process('SIM',Phase2C11I13M9,dd4hep) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryDD4hepExtended2026D76Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('TTbar_14TeV_TuneCP5_cfi nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') + +process.generator = cms.EDFilter("Pythia8GeneratorFilter", + PythiaParameters = cms.PSet( + parameterSets = cms.vstring( + 'pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters' + ), + processParameters = cms.vstring( + 'Top:gg2ttbar = on ', + 'Top:qqbar2ttbar = on ', + '6:m0 = 175 ' + ), + pythia8CP5Settings = cms.vstring( + 'Tune:pp 14', + 'Tune:ee 7', + 'MultipartonInteractions:ecmPow=0.03344', + 'MultipartonInteractions:bProfile=2', + 'MultipartonInteractions:pT0Ref=1.41', + 'MultipartonInteractions:coreRadius=0.7634', + 'MultipartonInteractions:coreFraction=0.63', + 'ColourReconnection:range=5.176', + 'SigmaTotal:zeroAXB=off', + 'SpaceShower:alphaSorder=2', + 'SpaceShower:alphaSvalue=0.118', + 'SigmaProcess:alphaSvalue=0.118', + 'SigmaProcess:alphaSorder=2', + 'MultipartonInteractions:alphaSvalue=0.118', + 'MultipartonInteractions:alphaSorder=2', + 'TimeShower:alphaSorder=2', + 'TimeShower:alphaSvalue=0.118', + 'SigmaTotal:mode = 0', + 'SigmaTotal:sigmaEl = 21.89', + 'SigmaTotal:sigmaTot = 100.309', + 'PDF:pSet=LHAPDF6:NNPDF31_nnlo_as_0118' + ), + pythia8CommonSettings = cms.vstring( + 'Tune:preferLHAPDF = 2', + 'Main:timesAllowErrors = 10000', + 'Check:epTolErr = 0.01', + 'Beams:setProductionScalesFromLHEF = off', + 'SLHA:minMassSM = 1000.', + 'ParticleDecays:limitTau0 = on', + 'ParticleDecays:tau0Max = 10', + 'ParticleDecays:allowPhotonRadiation = on' + ) + ), + comEnergy = cms.double(14000.0), + filterEfficiency = cms.untracked.double(1.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + pythiaPylistVerbosity = cms.untracked.int32(0) +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Geometry/HGCalCommonData/test/python/runHGCalD76DDD_cfg.py b/Geometry/HGCalCommonData/test/python/runHGCalD76DDD_cfg.py new file mode 100644 index 0000000000000..99280b4d6debd --- /dev/null +++ b/Geometry/HGCalCommonData/test/python/runHGCalD76DDD_cfg.py @@ -0,0 +1,150 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 + +process = cms.Process('SIM',Phase2C11I13M9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('TTbar_14TeV_TuneCP5_cfi nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') + +process.generator = cms.EDFilter("Pythia8GeneratorFilter", + PythiaParameters = cms.PSet( + parameterSets = cms.vstring( + 'pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters' + ), + processParameters = cms.vstring( + 'Top:gg2ttbar = on ', + 'Top:qqbar2ttbar = on ', + '6:m0 = 175 ' + ), + pythia8CP5Settings = cms.vstring( + 'Tune:pp 14', + 'Tune:ee 7', + 'MultipartonInteractions:ecmPow=0.03344', + 'MultipartonInteractions:bProfile=2', + 'MultipartonInteractions:pT0Ref=1.41', + 'MultipartonInteractions:coreRadius=0.7634', + 'MultipartonInteractions:coreFraction=0.63', + 'ColourReconnection:range=5.176', + 'SigmaTotal:zeroAXB=off', + 'SpaceShower:alphaSorder=2', + 'SpaceShower:alphaSvalue=0.118', + 'SigmaProcess:alphaSvalue=0.118', + 'SigmaProcess:alphaSorder=2', + 'MultipartonInteractions:alphaSvalue=0.118', + 'MultipartonInteractions:alphaSorder=2', + 'TimeShower:alphaSorder=2', + 'TimeShower:alphaSvalue=0.118', + 'SigmaTotal:mode = 0', + 'SigmaTotal:sigmaEl = 21.89', + 'SigmaTotal:sigmaTot = 100.309', + 'PDF:pSet=LHAPDF6:NNPDF31_nnlo_as_0118' + ), + pythia8CommonSettings = cms.vstring( + 'Tune:preferLHAPDF = 2', + 'Main:timesAllowErrors = 10000', + 'Check:epTolErr = 0.01', + 'Beams:setProductionScalesFromLHEF = off', + 'SLHA:minMassSM = 1000.', + 'ParticleDecays:limitTau0 = on', + 'ParticleDecays:tau0Max = 10', + 'ParticleDecays:allowPhotonRadiation = on' + ) + ), + comEnergy = cms.double(14000.0), + filterEfficiency = cms.untracked.double(1.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + pythiaPylistVerbosity = cms.untracked.int32(0) +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4Hep_cfg.py b/Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4Hep_cfg.py new file mode 100644 index 0000000000000..686bf572ba4b7 --- /dev/null +++ b/Geometry/HGCalCommonData/test/python/runHGCalWafer8DD4Hep_cfg.py @@ -0,0 +1,133 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11_dd4hep_cff import Phase2C11_dd4hep + +process = cms.Process('SIM',Phase2C11_dd4hep) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", + confGeomXMLFiles = cms.FileInPath('Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalwafer8-algorithm.xml'), + appendToDataLabel = cms.string('') + ) + +process.DDSpecParRegistryESProducer = cms.ESProducer("DDSpecParRegistryESProducer", + appendToDataLabel = cms.string('') +) + +process.DDVectorRegistryESProducer = cms.ESProducer("DDVectorRegistryESProducer", + appendToDataLabel = cms.string('')) + +process.DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer", + appendToDataLabel = cms.string('') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(2), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + process.MessageLogger.G4cout=dict() + process.MessageLogger.G4cerr=dict() + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('single pi E 1000'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(211), + MinEta = cms.double(1.48), + MaxEta = cms.double(3.01), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(999.99), + MaxE = cms.double(1000.01) + ), + Verbosity = cms.untracked.int32(0), ## set to 1 (or greater) for printouts + psethack = cms.string('single pi E 1000'), + AddAntiParticle = cms.bool(True), + firstRun = cms.untracked.uint32(1) +) + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Geometry/HGCalCommonData/test/python/runHGCalWafer8DDD_cfg.py b/Geometry/HGCalCommonData/test/python/runHGCalWafer8DDD_cfg.py new file mode 100644 index 0000000000000..95d92c52d6026 --- /dev/null +++ b/Geometry/HGCalCommonData/test/python/runHGCalWafer8DDD_cfg.py @@ -0,0 +1,118 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + +process = cms.Process('SIM',Phase2C11M9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Geometry.HGCalCommonData.testHGCalWafer8XML_cfi') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(2), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + process.MessageLogger.G4cout=dict() + process.MessageLogger.G4cerr=dict() + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('single pi E 1000'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(211), + MinEta = cms.double(1.48), + MaxEta = cms.double(3.01), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(999.99), + MaxE = cms.double(1000.01) + ), + Verbosity = cms.untracked.int32(0), ## set to 1 (or greater) for printouts + psethack = cms.string('single pi E 1000'), + AddAntiParticle = cms.bool(True), + firstRun = cms.untracked.uint32(1) +) + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Geometry/HGCalGeometry/test/HGCalGeometryTester.cc b/Geometry/HGCalGeometry/test/HGCalGeometryTester.cc index a1ce012b1cb07..13d5e9a89ab61 100644 --- a/Geometry/HGCalGeometry/test/HGCalGeometryTester.cc +++ b/Geometry/HGCalGeometry/test/HGCalGeometryTester.cc @@ -90,7 +90,7 @@ void HGCalGeometryTester::doTest(const HGCalGeometry* geom, ForwardSubdetector s for (int layer : layers) { for (int cell : cells) { DetId id1; - id1 = (DetId)(HGCalDetId(subdet, zside, layer, type, sector, cell)); + id1 = static_cast(HGCalDetId(subdet, zside, layer, type, sector, cell)); if (geom->topology().valid(id1)) { auto icell1 = geom->getGeometry(id1); GlobalPoint global1 = geom->getPosition(id1); @@ -135,7 +135,7 @@ void HGCalGeometryTester::doTestWafer(const HGCalGeometry* geom, DetId::Detector for (int cellU : cells) { for (int cellV : cells) { std::cout << "det " << det << " cell " << cellU << ":" << cellV << std::endl; - DetId id1 = (DetId)(HGCSiliconDetId(det, zside, type, layer, waferU, waferV, cellU, cellV)); + DetId id1 = static_cast(HGCSiliconDetId(det, zside, type, layer, waferU, waferV, cellU, cellV)); std::cout << HGCSiliconDetId(id1) << std::endl; if (geom->topology().valid(id1)) { auto icell1 = geom->getGeometry(id1); @@ -177,8 +177,14 @@ void HGCalGeometryTester::doTestScint(const HGCalGeometry* geom, DetId::Detector for (int layer : layers) { int type = geom->topology().dddConstants().getTypeTrap(layer); for (int ieta : ietas) { + std::pair typm = geom->topology().dddConstants().tileType(layer, ieta, 0); for (int iphi : iphis) { - DetId id1 = (DetId)(HGCScintillatorDetId(type, layer, zside * ieta, iphi)); + HGCScintillatorDetId detId(type, layer, zside * ieta, iphi); + if (typm.first >= 0) { + detId.setType(typm.first); + detId.setSiPM(typm.second); + } + DetId id1 = static_cast(detId); if (geom->topology().valid(id1)) { auto icell1 = geom->getGeometry(id1); GlobalPoint global1 = geom->getPosition(id1); diff --git a/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheckV15_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheckV15_cfg.py new file mode 100644 index 0000000000000..26c0e501fe10c --- /dev/null +++ b/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheckV15_cfg.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +process = cms.Process('PROD',Phase2C11) + +process.load("SimGeneral.HepPDTESSource.pdt_cfi") +process.load("Geometry.HGCalCommonData.testHGCalV15XML_cfi") +process.load("Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi") +process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi") +process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi") +process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi") +process.load('Geometry.HGCalGeometry.hgcalGeometryCheck_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.generator.initialSeed = 456789 + +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(14), + MinEta = cms.double(-3.5), + MaxEta = cms.double(3.5), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(9.99), + MaxE = cms.double(10.01) + ), + AddAntiParticle = cms.bool(False), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('hgcGeomStudyV15.root'), + closeFileFast = cms.untracked.bool(True) + ) + +#process.hgcalGeometryCheck.verbosity = True + +process.p1 = cms.Path(process.generator*process.hgcalGeometryCheck) diff --git a/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheck_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheck_cfg.py index 9adb13e4fa097..c026155e0e8be 100644 --- a/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheck_cfg.py +++ b/Geometry/HGCalGeometry/test/python/testHGCalGeometryCheck_cfg.py @@ -7,8 +7,8 @@ from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) -process.load('Configuration.Geometry.GeometryExtended2026D71_cff') -process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D76_cff') +process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff') process.load("SimGeneral.HepPDTESSource.pdt_cfi") process.load('Geometry.HGCalGeometry.hgcalGeometryCheck_cfi') @@ -42,7 +42,7 @@ ) process.TFileService = cms.Service("TFileService", - fileName = cms.string('hgcGeomStudy.root'), + fileName = cms.string('hgcGeomStudyV14.root'), closeFileFast = cms.untracked.bool(True) ) diff --git a/Geometry/HGCalGeometry/test/python/testHGCalGeometryV15_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalGeometryV15_cfg.py new file mode 100644 index 0000000000000..8763fb4064494 --- /dev/null +++ b/Geometry/HGCalGeometry/test/python/testHGCalGeometryV15_cfg.py @@ -0,0 +1,53 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +process = cms.Process("PROD",Phase2C11) + +process.load("SimGeneral.HepPDTESSource.pdt_cfi") +process.load("Geometry.HGCalCommonData.testHGCalV15XML_cfi") +process.load("Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi") +process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi") +process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi") +process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.generator.initialSeed = 456789 + +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(14), + MinEta = cms.double(-3.5), + MaxEta = cms.double(3.5), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(9.99), + MaxE = cms.double(10.01) + ), + AddAntiParticle = cms.bool(False), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.prodEE = cms.EDAnalyzer("HGCalGeometryTester", + Detector = cms.string("HGCalEESensitive"), + ) + +process.prodHEF = process.prodEE.clone( + Detector = "HGCalHESiliconSensitive", +) + +process.prodHEB = process.prodEE.clone( + Detector = "HGCalHEScintillatorSensitive", +) + +process.p1 = cms.Path(process.generator*process.prodEE*process.prodHEF*process.prodHEB) diff --git a/Geometry/HGCalGeometry/test/python/testHGCalGeometry_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalGeometry_cfg.py index 48915bf522071..0cf9c9acacdc9 100644 --- a/Geometry/HGCalGeometry/test/python/testHGCalGeometry_cfg.py +++ b/Geometry/HGCalGeometry/test/python/testHGCalGeometry_cfg.py @@ -1,14 +1,10 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("PROD") -process.load("SimGeneral.HepPDTESSource.pdt_cfi") +from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +process = cms.Process('PROD',Phase2C11) -process.load("Configuration.Geometry.GeometryExtended2026D71Reco_cff") -#process.load("Geometry.HGCalCommonData.testHGCalV14XML_cfi") -#process.load("Geometry.HGCalCommonData.hgcalParametersInitialization_cfi") -#process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi") -#process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi") -#process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi") +process.load("SimGeneral.HepPDTESSource.pdt_cfi") +process.load("Configuration.Geometry.GeometryExtended2026D76Reco_cff") process.load('FWCore.MessageService.MessageLogger_cfi') if hasattr(process,'MessageLogger'): diff --git a/Geometry/HGCalGeometry/test/python/testHGCalWaferInFileTestV15_cfg.py b/Geometry/HGCalGeometry/test/python/testHGCalWaferInFileTestV15_cfg.py new file mode 100644 index 0000000000000..6ad6349dcca56 --- /dev/null +++ b/Geometry/HGCalGeometry/test/python/testHGCalWaferInFileTestV15_cfg.py @@ -0,0 +1,48 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + +process = cms.Process("PROD",Phase2C11) +process.load("SimGeneral.HepPDTESSource.pdt_cfi") +process.load("Geometry.HGCalCommonData.testHGCalV15XML_cfi") +process.load("Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi") +process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi") +process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi") +process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi") +process.load("Geometry.HGCalGeometry.hgcalEEWaferInFileTest_cfi") + +process.load('FWCore.MessageService.MessageLogger_cfi') +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalGeom=dict() + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.generator.initialSeed = 456789 + +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(14), + MinEta = cms.double(-3.5), + MaxEta = cms.double(3.5), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(9.99), + MaxE = cms.double(10.01) + ), + AddAntiParticle = cms.bool(False), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1) + ) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +#process.hgcalEEWaferInFileTest.Verbosity = 1 + +process.hgcalHEWaferInFileTest = process.hgcalEEWaferInFileTest.clone( + NameSense = "HGCalHESiliconSensitive", + NameDevice = "HGCal HE Silicon", +) + +process.p1 = cms.Path(process.generator*process.hgcalEEWaferInFileTest*process.hgcalHEWaferInFileTest) diff --git a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml index 0a2b4fc3a560a..77e8e6801a1a5 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml @@ -5,11 +5,13 @@ 4, 4, 4, 24 + + - 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 + 3733, 1867, 112, 60, 0, 0, 0, 0, 1, 16, 3, 1 - 22, 24, 16, 7, 0x1, 0x3, 0x3F, 0xFF, 16, 16, 1, 2 + 50, 50, 50, 50, 0, 0, 0, 0, 16, 16, 2, 1 diff --git a/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc b/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc index 277a1ebd3aff2..52686842c01e6 100644 --- a/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc +++ b/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc @@ -40,7 +40,7 @@ using namespace cms; class DD4hep_TestMTDIdealGeometry : public edm::one::EDAnalyzer<> { public: explicit DD4hep_TestMTDIdealGeometry(const edm::ParameterSet&); - ~DD4hep_TestMTDIdealGeometry() = default; + ~DD4hep_TestMTDIdealGeometry() override = default; void beginJob() override {} void analyze(edm::Event const&, edm::EventSetup const&) override; diff --git a/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc b/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc index 49602b4492cf8..624bd560984b4 100644 --- a/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc +++ b/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc @@ -43,7 +43,6 @@ class TestMTDIdealGeometry : public edm::one::EDAnalyzer<> { void theBaseNumber(const DDGeoHistory& gh); private: - std::string label_; int nNodes_; std::string ddTopNodeName_; uint32_t theLayout_; @@ -51,15 +50,18 @@ class TestMTDIdealGeometry : public edm::one::EDAnalyzer<> { MTDBaseNumber thisN_; BTLNumberingScheme btlNS_; ETLNumberingScheme etlNS_; + + edm::ESGetToken cpvToken_; }; TestMTDIdealGeometry::TestMTDIdealGeometry(const edm::ParameterSet& iConfig) - : label_(iConfig.getUntrackedParameter("label", "")), - ddTopNodeName_(iConfig.getUntrackedParameter("ddTopNodeName", "BarrelTimingLayer")), + : ddTopNodeName_(iConfig.getUntrackedParameter("ddTopNodeName", "BarrelTimingLayer")), theLayout_(iConfig.getUntrackedParameter("theLayout", 1)), thisN_(), btlNS_(), - etlNS_() {} + etlNS_() { + cpvToken_ = esConsumes(); +} TestMTDIdealGeometry::~TestMTDIdealGeometry() {} @@ -74,8 +76,7 @@ void TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::EventSet return; } - edm::ESTransientHandle pDD; - iSetup.get().get(label_, pDD); + auto pDD = iSetup.getTransientHandle(cpvToken_); if (!pDD.isValid()) { edm::LogError("TestMTDIdealGeometry") << "ESTransientHandle pDD is not valid!"; @@ -145,9 +146,9 @@ void TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::EventSet bool isSens = false; - if (fv.geoHistory()[num - 1].logicalPart().specifics().size() > 0) { + if (!fv.geoHistory()[num - 1].logicalPart().specifics().empty()) { for (auto vec : fv.geoHistory()[num - 1].logicalPart().specifics()) { - for (auto elem : *vec) { + for (const auto& elem : *vec) { if (elem.second.name() == "SensitiveDetector") { isSens = true; break; diff --git a/Geometry/MTDCommonData/test/testMTDinDDD.py b/Geometry/MTDCommonData/test/testMTDinDDD.py index 5b1441cec285a..ba1b9147ce895 100644 --- a/Geometry/MTDCommonData/test/testMTDinDDD.py +++ b/Geometry/MTDCommonData/test/testMTDinDDD.py @@ -64,13 +64,11 @@ process.load('Configuration.Geometry.GeometryExtended2026D76_cff') process.testBTL = cms.EDAnalyzer("TestMTDIdealGeometry", - label = cms.untracked.string(''), ddTopNodeName = cms.untracked.string('BarrelTimingLayer'), theLayout = cms.untracked.uint32(4) ) process.testETL = cms.EDAnalyzer("TestMTDIdealGeometry", - label = cms.untracked.string(''), ddTopNodeName = cms.untracked.string('EndcapTimingLayer'), theLayout = cms.untracked.uint32(4) ) diff --git a/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h b/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h index e9ee6eb061122..e8959c23ea644 100644 --- a/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h +++ b/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h @@ -14,13 +14,14 @@ class MTDTopologyBuilder { MTDTopologyBuilder(); PixelTopology* build(const Bounds* bounds, - bool upgradeGeometry, - int ROWS_PER_ROC, // Num of Rows per ROC - int COLS_PER_ROC, // Num of Cols per ROC - int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC - int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC + int ROWS_PER_ROC, // Num of Rows per ROC + int COLS_PER_ROC, // Num of Cols per ROC int ROCS_X, - int ROCS_Y); + int ROCS_Y, + int GAPxInterpad, //This value is given in microns + int GAPxBorder, //This value is given in microns + int GAPyInterpad, //This value is given in microns + int GAPyBorder); //This value is given in microns }; #endif diff --git a/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h b/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h index 58b8cf7d32c94..dbba18a8e6aaf 100644 --- a/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h +++ b/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h @@ -43,13 +43,14 @@ class RectangularMTDTopology final : public PixelTopology { int ncols, float pitchx, float pitchy, - bool upgradeGeometry, - int ROWS_PER_ROC, // Num of Rows per ROC - int COLS_PER_ROC, // Num of Cols per ROC - int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC - int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC + int ROWS_PER_ROC, // Num of Rows per ROC + int COLS_PER_ROC, // Num of Cols per ROC int ROCS_X, - int ROCS_Y) + int ROCS_Y, + float GAPxInterpad, // Value given in cm + float GAPxBorder, // Value given in cm + float GAPyInterpad, // Value given in cm + float GAPyBorder) // Value given in cm : m_pitchx(pitchx), m_pitchy(pitchy), m_nrows(nrows), @@ -58,16 +59,18 @@ class RectangularMTDTopology final : public PixelTopology { m_COLS_PER_ROC(COLS_PER_ROC), // Num of Cols per ROC m_ROCS_X(ROCS_X), // 2 for SLHC m_ROCS_Y(ROCS_Y), // 8 for SLHC - m_upgradeGeometry(upgradeGeometry) { - setOffset(BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y, ROWS_PER_ROC, COLS_PER_ROC); + m_GAPxInterpad(GAPxInterpad), + m_GAPxBorder(GAPxBorder), + m_GAPyInterpad(GAPyInterpad), + m_GAPyBorder(GAPyBorder) { + m_xoffset = -(m_nrows / 2.) * m_pitchx; + m_yoffset = -(m_ncols / 2.) * m_pitchy; + m_GAPxInterpadFrac = m_GAPxInterpad / m_pitchx; + m_GAPxBorderFrac = m_GAPxBorder / m_pitchx; + m_GAPyInterpadFrac = m_GAPyInterpad / m_pitchy; + m_GAPyBorderFrac = m_GAPyBorder / m_pitchy; } - // Edge of the active sensor with respect to the center - void setOffset(const int& BIG_PIX_PER_ROC_X, - const int& BIG_PIX_PER_ROC_Y, - const int& ROWS_PER_ROC, - const int& COLS_PER_ROC); - // Topology interface, go from Masurement to Local module corrdinates // pixel coordinates (mp) -> cm (LocalPoint) LocalPoint localPosition(const MeasurementPoint& mp) const override; @@ -79,9 +82,11 @@ class RectangularMTDTopology final : public PixelTopology { } // PixelTopology interface. - // Transform LocalPoint in cm to measurement in pitch units. std::pair pixel(const LocalPoint& p) const override; + //check whether LocalPoint is inside the pixel active area + bool isInPixel(const LocalPoint& p) const; + // Errors // Error in local (cm) from the masurement errors LocalError localError(const MeasurementPoint&, const MeasurementError&) const override; @@ -90,7 +95,6 @@ class RectangularMTDTopology final : public PixelTopology { //------------------------------------------------------------- // Transform LocalPoint to channel. Call pixel() - // int channel(const LocalPoint& lp) const override { std::pair p = pixel(lp); return MTDChannelIdentifier::pixelToChannel(int(p.first), int(p.second)); @@ -114,50 +118,33 @@ class RectangularMTDTopology final : public PixelTopology { return pixelToModuleLocalPoint(plp, p.first, p.second); } - //------------------------------------------------------------- - // Transform measurement to local coordinates individually in each dimension - // - float localX(const float mpX) const override; - float localY(const float mpY) const override; - //------------------------------------------------------------- // Return the BIG pixel information for a given pixel - // - bool isItBigPixelInX(const int ixbin) const override { - return ((m_upgradeGeometry) ? (false) : ((ixbin == 79) | (ixbin == 80))); - } + bool isItBigPixelInX(const int ixbin) const override { return false; } - bool isItBigPixelInY(const int iybin) const override { - if - UNLIKELY(m_upgradeGeometry) return false; - else { - int iybin0 = iybin % 52; - return ((iybin0 == 0) | (iybin0 == 51)); - // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511}; - // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin; - } - } + bool isItBigPixelInY(const int iybin) const override { return false; } //------------------------------------------------------------- // Return BIG pixel flag in a given pixel range - // - bool containsBigPixelInX(int ixmin, int ixmax) const override { - return m_upgradeGeometry ? false : ((ixmin <= 80) & (ixmax >= 79)); - } - bool containsBigPixelInY(int iymin, int iymax) const override { - return m_upgradeGeometry ? false - : (isItBigPixelInY(iymin) || isItBigPixelInY(iymax) || (iymin / 52) != (iymax / 52)); - } + bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; } + + bool containsBigPixelInY(int iymin, int iymax) const override { return false; } - //------------------------------------------------------------- // Check whether the pixel is at the edge of the module - // bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); } + bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); } + bool isItEdgePixel(int ixbin, int iybin) const override { return (isItEdgePixelInX(ixbin) | isItEdgePixelInY(iybin)); } + //------------------------------------------------------------- + // Transform measurement to local coordinates individually in each dimension + // + float localX(const float mpX) const override; + float localY(const float mpY) const override; + //------------------------------------------------------------------ // Return pitch std::pair pitch() const override { return std::pair(float(m_pitchx), float(m_pitchy)); } @@ -175,6 +162,14 @@ class RectangularMTDTopology final : public PixelTopology { int colsperroc() const override { return m_COLS_PER_ROC; } float xoffset() const { return m_xoffset; } float yoffset() const { return m_yoffset; } + float gapxInterpad() const { return m_GAPxInterpad; } // Value returned in cm + float gapyInterpad() const { return m_GAPyInterpad; } // Value returned in cm + float gapxBorder() const { return m_GAPxBorder; } // Value returned in cm + float gapyBorder() const { return m_GAPyBorder; } // Value returned in cm + float gapxInterpadFrac() const { return m_GAPxInterpadFrac; } + float gapyInterpadFrac() const { return m_GAPyInterpadFrac; } + float gapxBorderFrac() const { return m_GAPxBorderFrac; } + float gapyBorderFrac() const { return m_GAPyBorderFrac; } private: float m_pitchx; @@ -187,7 +182,14 @@ class RectangularMTDTopology final : public PixelTopology { int m_COLS_PER_ROC; int m_ROCS_X; int m_ROCS_Y; - bool m_upgradeGeometry; + float m_GAPxInterpad; + float m_GAPxBorder; + float m_GAPyInterpad; + float m_GAPyBorder; + float m_GAPxInterpadFrac; + float m_GAPxBorderFrac; + float m_GAPyInterpadFrac; + float m_GAPyBorderFrac; }; #endif diff --git a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc index 73d9096394857..72fbbf82f6d1f 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc @@ -103,14 +103,23 @@ void MTDGeomBuilderFromGeometricTimingDet::buildPixel( // this is a hack while we put things into the DDD int ROCrows(0), ROCcols(0), ROCSx(0), ROCSy(0); + int GAPxInterpad(0), GAPxBorder(0), GAPyInterpad(0), GAPyBorder(0); switch (det) { case GeomDetType::SubDetector::TimingBarrel: + GAPxInterpad = ptp.vitems_[0].vpars_[0]; // Value given in microns + GAPxBorder = ptp.vitems_[0].vpars_[1]; // Value given in microns + GAPyInterpad = ptp.vitems_[0].vpars_[2]; // Value given in microns + GAPyBorder = ptp.vitems_[0].vpars_[3]; // Value given in microns ROCrows = ptp.vitems_[0].vpars_[8]; ROCcols = ptp.vitems_[0].vpars_[9]; ROCSx = ptp.vitems_[0].vpars_[10]; ROCSy = ptp.vitems_[0].vpars_[11]; break; case GeomDetType::SubDetector::TimingEndcap: + GAPxInterpad = ptp.vitems_[1].vpars_[0]; + GAPxBorder = ptp.vitems_[1].vpars_[1]; + GAPyInterpad = ptp.vitems_[1].vpars_[2]; + GAPyBorder = ptp.vitems_[1].vpars_[3]; ROCrows = ptp.vitems_[1].vpars_[8]; ROCcols = ptp.vitems_[1].vpars_[9]; ROCSx = ptp.vitems_[1].vpars_[10]; @@ -137,14 +146,8 @@ void MTDGeomBuilderFromGeometricTimingDet::buildPixel( if (theMTDDetTypeMap.find(detName) == theMTDDetTypeMap.end()) { std::unique_ptr bounds(i->bounds()); - PixelTopology* t = MTDTopologyBuilder().build(&*bounds, - true, - ROCrows, - ROCcols, - 0, - 0, // these are BIG_PIX_XXXXX - ROCSx, - ROCSy); + PixelTopology* t = MTDTopologyBuilder().build( + &*bounds, ROCrows, ROCcols, ROCSx, ROCSy, GAPxInterpad, GAPxBorder, GAPyInterpad, GAPyBorder); theMTDDetTypeMap[detName] = new MTDGeomDetType(t, detName, det); tracker->addType(theMTDDetTypeMap[detName]); diff --git a/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc b/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc index ee0206551dcdb..045803798e9ee 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc @@ -10,13 +10,14 @@ MTDTopologyBuilder::MTDTopologyBuilder(void) {} PixelTopology* MTDTopologyBuilder::build(const Bounds* bs, - bool upgradeGeometry, - int pixelROCRows, // Num of Rows per ROC - int pixelROCCols, // Num of Cols per ROC - int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC - int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC + int pixelROCRows, // Num of Rows per ROC + int pixelROCCols, // Num of Cols per ROC int pixelROCsInX, - int pixelROCsInY) { + int pixelROCsInY, + int GAPxInterpad, + int GAPxBorder, + int GAPyInterpad, + int GAPyBorder) { float width = bs->width(); // module width = Xsize float length = bs->length(); // module length = Ysize @@ -24,11 +25,14 @@ PixelTopology* MTDTopologyBuilder::build(const Bounds* bs, int nrows = pixelROCRows * pixelROCsInX; int ncols = pixelROCCols * pixelROCsInY; - // Take into account the large edge pixles - // 1 big pixel per ROC - float pitchX = width / (nrows + pixelROCsInX * BIG_PIX_PER_ROC_X); - // 2 big pixels per ROC - float pitchY = length / (ncols + pixelROCsInY * BIG_PIX_PER_ROC_Y); + float pitchX = width / nrows; + float pitchY = length / ncols; + + float micronsTocm = 1e-4; + float gapxinterpad = float(GAPxInterpad) * micronsTocm; //Convert to cm + float gapyinterpad = float(GAPyInterpad) * micronsTocm; //Convert to cm + float gapxborder = float(GAPxBorder) * micronsTocm; //Convert to cm + float gapyborder = float(GAPyBorder) * micronsTocm; //Convert to cm #ifdef EDM_ML_DEBUG edm::LogInfo("MTDTopologyBuilder") << std::fixed << "Building topology for module of width(X) = " << std::setw(10) @@ -40,18 +44,23 @@ PixelTopology* MTDTopologyBuilder::build(const Bounds* bs, << "\n # pixel rows X = " << std::setw(10) << nrows << " # pixel cols Y = " << std::setw(10) << ncols << "\n pitch in X = " << std::setw(10) << pitchX - << " # pitch in Y = " << std::setw(10) << pitchY; + << " # pitch in Y = " << std::setw(10) << pitchY + << "\n Interpad gap in X = " << std::setw(10) << gapxinterpad + << " # Interpad gap in Y = " << std::setw(10) << gapyinterpad + << "\n Border gap in X = " << std::setw(10) << gapxborder + << " # Border gap in Y = " << std::setw(10) << gapyborder; #endif return (new RectangularMTDTopology(nrows, ncols, pitchX, pitchY, - upgradeGeometry, pixelROCRows, // (int)rocRow pixelROCCols, // (int)rocCol - BIG_PIX_PER_ROC_X, - BIG_PIX_PER_ROC_Y, pixelROCsInX, - pixelROCsInY)); // (int)rocInX, (int)rocInY + pixelROCsInY, + gapxinterpad, + gapxborder, + gapyinterpad, + gapyborder)); } diff --git a/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc b/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc index b062af276b8bd..1daca844880d9 100644 --- a/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc +++ b/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc @@ -1,32 +1,5 @@ #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" -/** - * Topology for rectangular pixel detector with BIG pixels. - */ -// Modified for the large pixles. -// Danek Kotlinski & Michele Pioppi, 3/06. -// See documentation in the include file. - -//-------------------------------------------------------------------- -// Calculate the edge of the active sensor with respect to the center, -// that is simply the half-size. -// Take into account large pixels -void RectangularMTDTopology::setOffset(const int& BIG_PIX_PER_ROC_X, - const int& BIG_PIX_PER_ROC_Y, - const int& ROWS_PER_ROC, - const int& COLS_PER_ROC) { - m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X * m_nrows / ROWS_PER_ROC) / 2. * m_pitchx; - m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y * m_ncols / COLS_PER_ROC) / 2. * m_pitchy; - - LogDebug("RectangularMTDTopology") << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx " << m_pitchx - << ", pitchy " << m_pitchy << ", xoffset " << m_xoffset << ", yoffset " - << m_yoffset << ", BIG_PIX_PER_ROC_X " << BIG_PIX_PER_ROC_X - << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", ROWS_PER_ROC " << ROWS_PER_ROC - << ", COLS_PER_ROC " << COLS_PER_ROC << ", ROCS_X " << m_ROCS_X << ", ROCS_Y " - << m_ROCS_Y << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X << ", NCOL " - << m_COLS_PER_ROC * m_ROCS_Y; -} - //-------------------------------------------------------------------- // PixelTopology interface. // Transform LocalPoint in cm to measurement in pitch units. @@ -35,135 +8,31 @@ std::pair RectangularMTDTopology::pixel(const LocalPoint& p) const float py = p.y(); float px = p.x(); - LogDebug("RectangularMTDTopology").log([&](auto& debugstr) { -#define EPSCM 0 -#define EPS 0 - // This will catch points which are outside the active sensor area. - // In the digitizer during the early induce_signal phase non valid - // location are passed here. They are cleaned later. - debugstr << "py = " << py << ", m_yoffset = " << m_yoffset << "px = " << px << ", m_xoffset = " << m_xoffset - << "\n"; - - if (py < m_yoffset) // m_yoffset is negative - { - debugstr << " wrong lp y " << py << " " << m_yoffset << "\n"; - py = m_yoffset + EPSCM; // make sure it is in, add an EPS in cm - } - if (py > -m_yoffset) { - debugstr << " wrong lp y " << py << " " << -m_yoffset << "\n"; - py = -m_yoffset - EPSCM; - } - if (px < m_xoffset) // m_xoffset is negative - { - debugstr << " wrong lp x " << px << " " << m_xoffset << "\n"; - px = m_xoffset + EPSCM; - } - if (px > -m_xoffset) { - debugstr << " wrong lp x " << px << " " << -m_xoffset << "\n"; - px = -m_xoffset - EPSCM; - } - }); - + // In Y float newybin = (py - m_yoffset) / m_pitchy; - int iybin = int(newybin); - float fractionY = newybin - iybin; - - // Normalize it all to 1 ROC - int iybin0 = 0; - int numROC = 0; - float mpY = 0.; - - if (m_upgradeGeometry) { - iybin0 = (iybin % m_COLS_PER_ROC); // 0-51 - numROC = iybin / m_COLS_PER_ROC; // 0-7 - mpY = float(numROC * m_COLS_PER_ROC + iybin0) + fractionY; - -#ifdef EDM_ML_DEBUG - - if (iybin0 > m_COLS_PER_ROC) { - LogDebug("RectangularMTDTopology") << " very bad, newbiny " << iybin0 << "\n" - << py << " " << m_yoffset << " " << m_pitchy << " " << newybin << " " << iybin - << " " << fractionY << " " << iybin0 << " " << numROC; - } -#endif // EDM_ML_DEBUG - - } else { - iybin0 = (iybin % 54); // 0-53 - numROC = iybin / 54; // 0-7 - - if (iybin0 == 53) { // inside big pixel - iybin0 = 51; - fractionY = (fractionY + 1.) / 2.; - } else if (iybin0 == 52) { // inside big pixel - iybin0 = 51; - fractionY = fractionY / 2.; - } else if (iybin0 > 1) { // inside normal pixel - iybin0 = iybin0 - 1; - } else if (iybin0 == 1) { // inside big pixel - iybin0 = 0; - fractionY = (fractionY + 1.) / 2.; - } else if (iybin0 == 0) { // inside big pixel - iybin0 = 0; - fractionY = fractionY / 2.; - } - - mpY = float(numROC * 52. + iybin0) + fractionY; - } - -#ifdef EDM_ML_DEBUG - - if (mpY < 0. || mpY >= 416.) { - LogDebug("RectangularMTDTopology") << " bad pix y " << mpY << "\n" - << py << " " << m_yoffset << " " << m_pitchy << " " << newybin << " " << iybin - << " " << fractionY << " " << iybin0 << " " << numROC; - } -#endif // EDM_ML_DEBUG - // In X float newxbin = (px - m_xoffset) / m_pitchx; - int ixbin = int(newxbin); - float fractionX = newxbin - ixbin; - -#ifdef EDM_ML_DEBUG - if (ixbin > 161 || ixbin < 0) // ixbin < 0 outside range - { - LogDebug("RectangularMTDTopology") << " very bad, newbinx " << ixbin << "\n" - << px << " " << m_xoffset << " " << m_pitchx << " " << newxbin << " " << ixbin - << " " << fractionX; - } -#endif // EDM_ML_DEBUG + return std::pair(newxbin, newybin); +} - if (!m_upgradeGeometry) { - if (ixbin > 82) { // inside normal pixel, ROC 1 - ixbin = ixbin - 2; - } else if (ixbin == 82) { // inside bin pixel - ixbin = 80; - fractionX = (fractionX + 1.) / 2.; - } else if (ixbin == 81) { // inside big pixel - ixbin = 80; - fractionX = fractionX / 2.; - } else if (ixbin == 80) { // inside bin pixel, ROC 0 - ixbin = 79; - fractionX = (fractionX + 1.) / 2.; - } else if (ixbin == 79) { // inside big pixel - ixbin = 79; - fractionX = fractionX / 2.; - } +//The following lines check whether the point is actually out of the active pixel area. +bool RectangularMTDTopology::isInPixel(const LocalPoint& p) const { + bool isInside = true; + const auto& thepixel = pixel(p); + const int ixbin = static_cast(thepixel.first); + const int iybin = static_cast(thepixel.second); + const float fractionX = thepixel.first - ixbin; + const float fractionY = thepixel.second - iybin; + if ((fractionX > 1.0 - m_GAPxInterpadFrac || fractionX < m_GAPxInterpadFrac) || + (ixbin == 0 && fractionX < m_GAPxBorderFrac) || (ixbin == m_nrows - 1 && fractionX > 1.0 - m_GAPxBorderFrac)) { + isInside = false; } - - float mpX = float(ixbin) + fractionX; - -#ifdef EDM_ML_DEBUG - - if (mpX < 0. || mpX >= 160.) { - LogDebug("RectangularMTDTopology") << " bad pix x " << mpX << "\n" - << px << " " << m_xoffset << " " << m_pitchx << " " << newxbin << " " << ixbin - << " " << fractionX; + if ((fractionY > 1.0 - m_GAPyInterpadFrac || fractionY < m_GAPyInterpadFrac) || + (iybin == 0 && fractionY < m_GAPyBorderFrac) || (iybin == m_ncols - 1 && fractionY > 1.0 - m_GAPyBorderFrac)) { + isInside = false; } -#endif // EDM_ML_DEBUG - - return std::pair(mpX, mpY); + return isInside; } //---------------------------------------------------------------------- @@ -173,31 +42,6 @@ LocalPoint RectangularMTDTopology::localPosition(const MeasurementPoint& mp) con float mpy = mp.y(); // measurements float mpx = mp.x(); -#ifdef EDM_ML_DEBUG -#define EPS 0 - // check limits - std::ostringstream debugstr; - - if (mpy < 0.) { - debugstr << " wrong mp y, fix " << mpy << " " << 0 << "\n"; - mpy = 0.; - } - if (mpy >= m_ncols) { - debugstr << " wrong mp y, fix " << mpy << " " << m_ncols << "\n"; - mpy = float(m_ncols) - EPS; // EPS is a small number - } - if (mpx < 0.) { - debugstr << " wrong mp x, fix " << mpx << " " << 0 << "\n"; - mpx = 0.; - } - if (mpx >= m_nrows) { - debugstr << " wrong mp x, fix " << mpx << " " << m_nrows << "\n"; - mpx = float(m_nrows) - EPS; // EPS is a small number - } - if (!debugstr.str().empty()) - LogDebug("RectangularMTDTopology") << debugstr.str(); -#endif // EDM_ML_DEBUG - float lpY = localY(mpy); float lpX = localX(mpx); @@ -208,97 +52,16 @@ LocalPoint RectangularMTDTopology::localPosition(const MeasurementPoint& mp) con //-------------------------------------------------------------------- // // measuremet to local transformation for X coordinate -// X coordinate is in the ROC row number direction float RectangularMTDTopology::localX(const float mpx) const { - int binoffx = int(mpx); // truncate to int - float fractionX = mpx - float(binoffx); // find the fraction - float local_pitchx = m_pitchx; // defaultpitch - - if - UNLIKELY(m_upgradeGeometry) { -#ifdef EDM_ML_DEBUG - if (binoffx > m_ROWS_PER_ROC * m_ROCS_X) // too large - { - LogDebug("RectangularMTDTopology") - << " very bad, binx " << binoffx << "\n" - << mpx << " " << binoffx << " " << fractionX << " " << local_pitchx << " " << m_xoffset << "\n"; - } -#endif - } - else { - if (binoffx > 80) { // ROC 1 - handles x on edge cluster - binoffx = binoffx + 2; - } else if (binoffx == 80) { // ROC 1 - binoffx = binoffx + 1; - local_pitchx *= 2; - } else if (binoffx == 79) { // ROC 0 - binoffx = binoffx + 0; - local_pitchx *= 2; - } - // else if (binoffx>=0) { // ROC 0 - // binoffx=binoffx+0; - // } - -#ifdef EDM_ML_DEBUG - if (binoffx < 0) // too small - LogDebug("RectangularMTDTopology") << " very bad, binx " << binoffx << "\n" - << mpx << " " << binoffx << " " << fractionX << " " << local_pitchx << " " - << m_xoffset; -#endif - } - // The final position in local coordinates - float lpX = float(binoffx * m_pitchx) + fractionX * local_pitchx + m_xoffset; - -#ifdef EDM_ML_DEBUG - - if (lpX < m_xoffset || lpX > (-m_xoffset)) { - LogDebug("RectangularMTDTopology") << " bad lp x " << lpX << "\n" - << mpx << " " << binoffx << " " << fractionX << " " << local_pitchx << " " - << m_xoffset; - } -#endif // EDM_ML_DEBUG + float lpX = mpx * m_pitchx + m_xoffset; return lpX; } -// measuremet to local transformation for Y coordinate -// Y is in the ROC column number direction float RectangularMTDTopology::localY(const float mpy) const { - int binoffy = int(mpy); // truncate to int - float fractionY = mpy - float(binoffy); // find the fraction - float local_pitchy = m_pitchy; // defaultpitch - - if - UNLIKELY(m_upgradeGeometry) { -#ifdef EDM_ML_DEBUG - if (binoffy > m_ROCS_Y * m_COLS_PER_ROC) // too large - { - LogDebug("RectangularMTDTopology") - << " very bad, biny " << binoffy << "\n" - << mpy << " " << binoffy << " " << fractionY << " " << local_pitchy << " " << m_yoffset; - } -#endif - } - else { // 415 is last big pixel, 416 and above do not exists! - constexpr int bigYIndeces[]{0, 51, 52, 103, 104, 155, 156, 207, 208, 259, 260, 311, 312, 363, 364, 415, 416, 511}; - auto const j = std::lower_bound(std::begin(bigYIndeces), std::end(bigYIndeces), binoffy); - if (*j == binoffy) - local_pitchy *= 2; - binoffy += (j - bigYIndeces); - } - // The final position in local coordinates - float lpY = float(binoffy * m_pitchy) + fractionY * local_pitchy + m_yoffset; - -#ifdef EDM_ML_DEBUG - - if (lpY < m_yoffset || lpY > (-m_yoffset)) { - LogDebug("RectangularMTDTopology") << " bad lp y " << lpY << "\n" - << mpy << " " << binoffy << " " << fractionY << " " << local_pitchy << " " - << m_yoffset; - } -#endif // EDM_ML_DEBUG + float lpY = mpy * m_pitchy + m_yoffset; return lpY; } @@ -306,38 +69,11 @@ float RectangularMTDTopology::localY(const float mpy) const { /////////////////////////////////////////////////////////////////// // Get hit errors in LocalPoint coordinates (cm) LocalError RectangularMTDTopology::localError(const MeasurementPoint& mp, const MeasurementError& me) const { - float pitchy = m_pitchy; - int binoffy = int(mp.y()); - if (isItBigPixelInY(binoffy)) - pitchy = 2. * m_pitchy; - - float pitchx = m_pitchx; - int binoffx = int(mp.x()); - if (isItBigPixelInX(binoffx)) - pitchx = 2. * m_pitchx; - - return LocalError(me.uu() * float(pitchx * pitchx), 0, me.vv() * float(pitchy * pitchy)); + return LocalError(me.uu() * float(m_pitchx * m_pitchx), 0, me.vv() * float(m_pitchy * m_pitchy)); } ///////////////////////////////////////////////////////////////////// // Get errors in pixel pitch units. MeasurementError RectangularMTDTopology::measurementError(const LocalPoint& lp, const LocalError& le) const { - float pitchy = m_pitchy; - float pitchx = m_pitchx; - - if - LIKELY(!m_upgradeGeometry) { - int iybin = int((lp.y() - m_yoffset) / m_pitchy); //get bin for equal picth - int iybin0 = iybin % 54; //This is just to avoid many ifs by using the periodicy - //quasi bins 0,1,52,53 fall into larger pixels - if ((iybin0 <= 1) | (iybin0 >= 52)) - pitchy = 2.f * m_pitchy; - - int ixbin = int((lp.x() - m_xoffset) / m_pitchx); //get bin for equal pitch - //quasi bins 79,80,81,82 fall into the 2 larger pixels - if ((ixbin >= 79) & (ixbin <= 82)) - pitchx = 2.f * m_pitchx; - } - - return MeasurementError(le.xx() / float(pitchx * pitchx), 0, le.yy() / float(pitchy * pitchy)); + return MeasurementError(le.xx() / float(m_pitchx * m_pitchx), 0, le.yy() / float(m_pitchy * m_pitchy)); } diff --git a/Geometry/MTDGeometryBuilder/test/BuildFile.xml b/Geometry/MTDGeometryBuilder/test/BuildFile.xml index 78409a3c16f8d..a4e689eabb3c7 100644 --- a/Geometry/MTDGeometryBuilder/test/BuildFile.xml +++ b/Geometry/MTDGeometryBuilder/test/BuildFile.xml @@ -11,4 +11,22 @@ + + + + + + + + + + + + + + + + + + diff --git a/Geometry/MTDGeometryBuilder/test/DD4hep_TestBTLPixelTopology.cc b/Geometry/MTDGeometryBuilder/test/DD4hep_TestBTLPixelTopology.cc new file mode 100644 index 0000000000000..d5385bdc76767 --- /dev/null +++ b/Geometry/MTDGeometryBuilder/test/DD4hep_TestBTLPixelTopology.cc @@ -0,0 +1,331 @@ +//#define EDM_ML_DEBUG + +#include +#include +#include +#include +#include +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/Records/interface/DDSpecParRegistryRcd.h" + +#include "DetectorDescription/DDCMS/interface/DDDetector.h" +#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDFilteredView.h" +#include "DetectorDescription/DDCMS/interface/DDSpecParRegistry.h" + +#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h" +#include "Geometry/MTDCommonData/interface/MTDBaseNumber.h" +#include "Geometry/MTDCommonData/interface/BTLNumberingScheme.h" +#include "Geometry/MTDCommonData/interface/ETLNumberingScheme.h" + +#include "DataFormats/ForwardDetId/interface/BTLDetId.h" +#include "DataFormats/ForwardDetId/interface/ETLDetId.h" + +#include "Geometry/Records/interface/MTDTopologyRcd.h" +#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" +#include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h" +#include "Geometry/Records/interface/MTDDigiGeometryRecord.h" +#include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h" +#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" + +#include "DataFormats/Math/interface/GeantUnits.h" +#include "DataFormats/Math/interface/Rounding.h" +#include + +using namespace cms; +using namespace geant_units::operators; + +class DD4hep_TestBTLPixelTopology : public edm::one::EDAnalyzer<> { +public: + explicit DD4hep_TestBTLPixelTopology(const edm::ParameterSet&); + ~DD4hep_TestBTLPixelTopology() = default; + + void beginJob() override {} + void analyze(edm::Event const&, edm::EventSetup const&) override; + void endJob() override {} + + void theBaseNumber(cms::DDFilteredView& fv); + +private: + const edm::ESInputTag tag_; + + MTDBaseNumber thisN_; + BTLNumberingScheme btlNS_; + + edm::ESGetToken dddetToken_; + edm::ESGetToken dspecToken_; + edm::ESGetToken mtdtopoToken_; + edm::ESGetToken mtdgeoToken_; + + std::stringstream sunitt; + constexpr static double tolerance{0.5e-3_mm}; +}; + +using DD3Vector = ROOT::Math::DisplacementVector3D>; +using cms_rounding::roundIfNear0; + +DD4hep_TestBTLPixelTopology::DD4hep_TestBTLPixelTopology(const edm::ParameterSet& iConfig) + : tag_(iConfig.getParameter("DDDetector")), thisN_(), btlNS_() { + dddetToken_ = esConsumes(tag_); + dspecToken_ = esConsumes(tag_); + mtdtopoToken_ = esConsumes(tag_); + mtdgeoToken_ = esConsumes(tag_); +} + +void DD4hep_TestBTLPixelTopology::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + auto pDD = iSetup.getTransientHandle(dddetToken_); + + auto pSP = iSetup.getTransientHandle(dspecToken_); + + if (!pDD.isValid()) { + edm::LogError("DD4hep_TestBTLPixelTopology") << "ESTransientHandle pDD is not valid!"; + return; + } + if (pDD.description()) { + edm::LogInfo("DD4hep_TestBTLPixelTopology") << pDD.description()->type_ << " label: " << pDD.description()->label_; + } else { + edm::LogWarning("DD4hep_TestBTLPixelTopology") << "NO label found pDD.description() returned false."; + } + + if (!pSP.isValid()) { + edm::LogError("DD4hep_TestBTLPixelTopology") << "ESTransientHandle pSP is not valid!"; + return; + } + + auto pTP = iSetup.getTransientHandle(mtdtopoToken_); + if (!pTP.isValid()) { + edm::LogError("DD4hep_TestBTLPixelTopology") << "ESTransientHandle pTP is not valid!"; + return; + } else { + edm::LogInfo("DD4hep_TestBTLPixelTopology") + << "MTD topology mode = " << pTP.product()->getMTDTopologyMode() << " BTLDetId:CrysLayout = " + << static_cast(MTDTopologyMode::crysLayoutFromTopoMode(pTP.product()->getMTDTopologyMode())); + } + + auto pDG = iSetup.getTransientHandle(mtdgeoToken_); + if (!pDG.isValid()) { + edm::LogError("DD4hep_TestBTLPixelTopology") << "ESTransientHandle pDG is not valid!"; + return; + } else { + edm::LogInfo("DD4hep_TestBTLPixelTopology") + << "Geometry node for MTDGeom is " << &(*pDG) << "\n" + << " # detectors = " << pDG.product()->detUnits().size() << "\n" + << " # types = " << pDG.product()->detTypes().size() << "\n" + << " # BTL dets = " << pDG.product()->detsBTL().size() << "\n" + << " # ETL dets = " << pDG.product()->detsETL().size() << "\n" + << " # layers " << pDG.product()->geomDetSubDetector(1) << " = " << pDG.product()->numberOfLayers(1) << "\n" + << " # layers " << pDG.product()->geomDetSubDetector(2) << " = " << pDG.product()->numberOfLayers(2) << "\n"; + } + + DDFilteredView fv(pDD.product(), pDD.product()->description()->worldVolume()); + fv.next(0); + + DDSpecParRefs specs; + std::string attribute("ReadOutName"), name("FastTimerHitsBarrel"); + pSP.product()->filter(specs, attribute, name); + + edm::LogVerbatim("DD4hep_TestBTLPixelTopology").log([&specs](auto& log) { + log << "Filtered DD SpecPar Registry size: " << specs.size() << "\n"; + for (const auto& t : specs) { + log << "\nSpecPar " << t.first << ":\nRegExps { "; + for (const auto& ki : t.second->paths) + log << ki << " "; + log << "};\n "; + for (const auto& kl : t.second->spars) { + log << kl.first << " = "; + for (const auto& kil : kl.second) { + log << kil << " "; + } + log << "\n "; + } + } + }); + + bool isBarrel = true; + bool exitLoop = false; + uint32_t level(0); + + do { + if (dd4hep::dd::noNamespace(fv.name()) == "BarrelTimingLayer") { + isBarrel = true; + edm::LogInfo("DD4hep_TestBTLPixelTopology") << "isBarrel = " << isBarrel; + } else if (dd4hep::dd::noNamespace(fv.name()) == "EndcapTimingLayer") { + isBarrel = false; + edm::LogInfo("DD4hep_TestBTLPixelTopology") << "isBarrel = " << isBarrel; + } + + theBaseNumber(fv); + + auto print_path = [&]() { + std::stringstream ss; + ss << " - OCMS[0]/"; + for (int ii = thisN_.getLevels() - 1; ii-- > 0;) { + ss << thisN_.getLevelName(ii); + ss << "["; + ss << thisN_.getCopyNumber(ii); + ss << "]/"; + } + return ss.str(); + }; + + if (level > 0 && fv.navPos().size() < level) { + level = 0; + exitLoop = true; + } + if (dd4hep::dd::noNamespace(fv.name()) == "BarrelTimingLayer") { + level = fv.navPos().size(); + } + + // Test only the desired subdetector + + if (exitLoop && isBarrel) { + break; + } + + // Actions for MTD volumes: search for sensitive detectors + + bool isSens = false; + + for (auto const& t : specs) { + for (auto const& it : t.second->paths) { + if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(fv.name()), dd4hep::dd::realTopName(it))) { + isSens = true; + break; + } + } + } + + if (isSens && isBarrel) { + std::stringstream spix; + spix << print_path() << "\n\n"; + + BTLDetId theId(btlNS_.getUnitID(thisN_)); + + DetId geoId = theId.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(pTP.product()->getMTDTopologyMode())); + const MTDGeomDet* thedet = pDG.product()->idToDet(geoId); + + if (thedet == nullptr) { + throw cms::Exception("BTLDeviceSim") << "GeographicalID: " << std::hex << geoId.rawId() << " (" << theId.rawId() + << ") is invalid!" << std::dec << std::endl; + } + const ProxyMTDTopology& topoproxy = static_cast(thedet->topology()); + const RectangularMTDTopology& topo = static_cast(topoproxy.specificTopology()); + + int origRow = theId.row(topo.nrows()); + int origCol = theId.column(topo.nrows()); + spix << "rawId= " << theId.rawId() << " side/rod= " << theId.mtdSide() << " / " << theId.mtdRR() + << " module/geomodule= " << theId.module() << " / " << static_cast(geoId).module() + << " crys/type= " << theId.crystal() << " / " << theId.modType() << " BTLDetId row/col= " << origRow << " / " + << origCol; + spix << "\n"; + + // + // Test of positions for sensitive detectors + // + + auto fround = [&](double in) { + std::stringstream ss; + ss << std::fixed << std::setw(14) << roundIfNear0(in); + return ss.str(); + }; + + if (!dd4hep::isA(fv.solid())) { + throw cms::Exception("DD4hep_TestBTLPixelTopology") << "MTD sensitive element not a DDBox"; + break; + } + dd4hep::Box mySens(fv.solid()); + + DD3Vector zeroLocal(0., 0., 0.); + DD3Vector cn1Local(mySens.x(), mySens.y(), mySens.z()); + DD3Vector cn2Local(-mySens.x(), -mySens.y(), -mySens.z()); + DD3Vector zeroGlobal = (fv.rotation())(zeroLocal) + fv.translation(); + DD3Vector cn1Global = (fv.rotation())(cn1Local) + fv.translation(); + DD3Vector cn2Global = (fv.rotation())(cn2Local) + fv.translation(); + + const size_t nTest(3); + std::array refLocalPoints{{Local3DPoint(zeroLocal.x(), zeroLocal.y(), zeroLocal.z()), + Local3DPoint(cn1Local.x(), cn1Local.y(), cn1Local.z()), + Local3DPoint(cn2Local.x(), cn2Local.y(), cn2Local.z())}}; + std::array refGlobalPoints{{zeroGlobal, cn1Global, cn2Global}}; + + for (size_t iloop = 0; iloop < nTest; iloop++) { + // translate from crystal-local coordinates to module-local coordinates to get the row and column + + Local3DPoint cmRefLocal(convertMmToCm(refLocalPoints[iloop].x() / dd4hep::mm), + convertMmToCm(refLocalPoints[iloop].y() / dd4hep::mm), + convertMmToCm(refLocalPoints[iloop].z() / dd4hep::mm)); + Local3DPoint modLocal = topo.pixelToModuleLocalPoint(cmRefLocal, origRow, origCol); + const auto& thepixel = topo.pixel(modLocal); + uint8_t recoRow(thepixel.first), recoCol(thepixel.second); + + if (origRow != recoRow || origCol != recoCol) { + std::stringstream warnmsg; + warnmsg << "DIFFERENCE row/col, orig= " << origRow << " " << origCol + << " reco= " << static_cast(recoRow) << " " << static_cast(recoCol) << "\n"; + spix << warnmsg.str(); + sunitt << warnmsg.str(); + recoRow = origRow; + recoCol = origCol; + } + + // reconstructed global position from reco geometry and rectangluar MTD topology + + const auto& modGlobal = thedet->toGlobal(modLocal); + + const double deltax = convertCmToMm(modGlobal.x()) - (refGlobalPoints[iloop].x() / dd4hep::mm); + const double deltay = convertCmToMm(modGlobal.y()) - (refGlobalPoints[iloop].y() / dd4hep::mm); + const double deltaz = convertCmToMm(modGlobal.z()) - (refGlobalPoints[iloop].z() / dd4hep::mm); + + spix << "Ref#" << iloop << " local= " << fround(refLocalPoints[iloop].x() / dd4hep::mm) + << fround(refLocalPoints[iloop].y() / dd4hep::mm) << fround(refLocalPoints[iloop].z() / dd4hep::mm) + << " Orig global= " << fround(refGlobalPoints[iloop].x() / dd4hep::mm) + << fround(refGlobalPoints[iloop].y() / dd4hep::mm) << fround(refGlobalPoints[iloop].z() / dd4hep::mm) + << " Reco global= " << fround(convertCmToMm(modGlobal.x())) << fround(convertCmToMm(modGlobal.y())) + << fround(convertCmToMm(modGlobal.z())) << " Delta= " << fround(deltax) << fround(deltay) << fround(deltaz) + << "\n"; + if (std::abs(deltax) > tolerance || std::abs(deltay) > tolerance || std::abs(deltaz) > tolerance) { + std::stringstream warnmsg; + warnmsg << "DIFFERENCE detId/ref# " << theId.rawId() << " " << iloop << " dx/dy/dz= " << fround(deltax) + << fround(deltay) << fround(deltaz) << "\n"; + spix << warnmsg.str(); + sunitt << warnmsg.str(); + } + } + + spix << "\n"; + edm::LogVerbatim("DD4hep_TestBTLPixelTopology") << spix.str(); + } + } while (fv.next(0)); + + if (!sunitt.str().empty()) { + edm::LogVerbatim("MTDUnitTest") << sunitt.str(); + } +} + +void DD4hep_TestBTLPixelTopology::theBaseNumber(cms::DDFilteredView& fv) { + thisN_.reset(); + thisN_.setSize(fv.navPos().size()); + + for (uint ii = 0; ii < fv.navPos().size(); ii++) { + std::string name((fv.geoHistory()[ii])->GetName()); + name.assign(name.erase(name.rfind('_'))); + int copyN(fv.copyNos()[ii]); + thisN_.addLevel(name, copyN); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("DD4hep_TestBTLPixelTopology") << name << " " << copyN; +#endif + } +} + +DEFINE_FWK_MODULE(DD4hep_TestBTLPixelTopology); diff --git a/Geometry/MTDGeometryBuilder/test/MTDDigiGeometryAnalyzer.cc b/Geometry/MTDGeometryBuilder/test/MTDDigiGeometryAnalyzer.cc index 37323aed2a876..c4a3cdcd8337e 100644 --- a/Geometry/MTDGeometryBuilder/test/MTDDigiGeometryAnalyzer.cc +++ b/Geometry/MTDGeometryBuilder/test/MTDDigiGeometryAnalyzer.cc @@ -30,7 +30,7 @@ class MTDDigiGeometryAnalyzer : public edm::one::EDAnalyzer<> { public: - explicit MTDDigiGeometryAnalyzer(const edm::ParameterSet&) {} + explicit MTDDigiGeometryAnalyzer(const edm::ParameterSet&); ~MTDDigiGeometryAnalyzer() override = default; void beginJob() override {} @@ -40,19 +40,25 @@ class MTDDigiGeometryAnalyzer : public edm::one::EDAnalyzer<> { private: void analyseRectangle(const GeomDetUnit& det); void checkRotation(const GeomDetUnit& det); + void checkRectangularMTDTopology(const RectangularMTDTopology&); std::stringstream sunitt; + + edm::ESGetToken mtdgeoToken_; }; using cms_rounding::roundIfNear0, cms_rounding::roundVecIfNear0; +MTDDigiGeometryAnalyzer::MTDDigiGeometryAnalyzer(const edm::ParameterSet& iConfig) { + mtdgeoToken_ = esConsumes(); +} + // ------------ method called to produce the data ------------ void MTDDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // // get the MTDGeometry // - edm::ESHandle pDD; - iSetup.get().get(pDD); + auto pDD = iSetup.getTransientHandle(mtdgeoToken_); edm::LogInfo("MTDDigiGeometryAnalyzer") << "Geometry node for MTDGeom is " << &(*pDD) << "\n" << " # detectors = " << pDD->detUnits().size() << "\n" @@ -91,13 +97,21 @@ void MTDDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::Event if (dynamic_cast((it)) != nullptr) { const PixelTopology& p = (dynamic_cast((it)))->specificTopology(); const RectangularMTDTopology& topo = static_cast(p); + auto pitchval = topo.pitch(); edm::LogVerbatim("MTDDigiGeometryAnalyzer") << "\n Subdetector " << it->subDetector() << " MTD Det " << it->name() << "\n" << " Rows " << topo.nrows() << " Columns " << topo.ncolumns() << " ROCS X " << topo.rocsX() - << " ROCS Y " << topo.rocsY() << " Rows/ROC " << topo.rowsperroc() << " Cols/ROC " << topo.colsperroc(); + << " ROCS Y " << topo.rocsY() << " Rows/ROC " << topo.rowsperroc() << " Cols/ROC " << topo.colsperroc() + << " Pitch X " << pitchval.first << " Pitch Y " << pitchval.second << " Sensor Interpad X " + << topo.gapxInterpad() << " Sensor Interpad Y " << topo.gapyInterpad() << " Sensor Border X " + << topo.gapxBorder() << " Sensor Border Y " << topo.gapyBorder(); sunitt << std::fixed << std::setw(7) << it->subDetector() << std::setw(4) << topo.nrows() << std::setw(4) << topo.ncolumns() << std::setw(4) << std::setw(4) << topo.rocsX() << std::setw(4) << topo.rocsY() - << std::setw(4) << topo.rowsperroc() << std::setw(4) << topo.colsperroc() << "\n"; + << std::setw(4) << topo.rowsperroc() << std::setw(4) << topo.colsperroc() << std::setw(10) + << pitchval.first << std::setw(10) << pitchval.second << std::setw(10) << topo.gapxInterpad() + << std::setw(10) << topo.gapyInterpad() << std::setw(10) << topo.gapxBorder() << std::setw(10) + << topo.gapyBorder() << "\n"; + checkRectangularMTDTopology(topo); } } @@ -112,6 +126,19 @@ void MTDDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::Event edm::LogVerbatim("MTDUnitTest") << sunitt.str(); } +void MTDDigiGeometryAnalyzer::checkRectangularMTDTopology(const RectangularMTDTopology& topo) { + std::stringstream pixelinfo; + pixelinfo << "Pixel center location:\n"; + LocalPoint center(0, 0, 0); + for (int r = 0; r < topo.nrows(); r++) { + for (int c = 0; c < topo.ncolumns(); c++) { + sunitt << r << " " << c << " " << topo.pixelToModuleLocalPoint(center, r, c) << "\n"; + pixelinfo << r << " " << c << " " << topo.pixelToModuleLocalPoint(center, r, c) << "\n"; + } + } + edm::LogVerbatim("MTDDigiGeometryAnalyzer") << pixelinfo.str(); +} + void MTDDigiGeometryAnalyzer::analyseRectangle(const GeomDetUnit& det) { const double safety = 0.9999; diff --git a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py index 3c421e639d1dc..abc28919dc8ed 100644 --- a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py @@ -28,6 +28,9 @@ MTDDigiGeometryAnalyzer = cms.untracked.PSet( limit = cms.untracked.int32(-1) ), + DD4hep_TestBTLPixelTopology = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), enable = cms.untracked.bool(True), enableStatistics = cms.untracked.bool(True), noLineBreaks = cms.untracked.bool(True), @@ -83,5 +86,8 @@ process.Timing = cms.Service("Timing") process.prod = cms.EDAnalyzer("MTDDigiGeometryAnalyzer") +process.prod1 = cms.EDAnalyzer("DD4hep_TestBTLPixelTopology", + DDDetector = cms.ESInputTag('',''), +) -process.p1 = cms.Path(process.prod) +process.p1 = cms.Path(process.prod+process.prod1) diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index 450d75ec27041..363230df0ba37 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -8,163 +8,14 @@ #include #include -//knower of all things tracker geometry -//flexible replacement for PXBDetId and friends -//to implement -// endcap pixel - class MTDTopology { public: - struct BTLValues { - unsigned int sideStartBit_; - unsigned int layerStartBit_; - unsigned int trayStartBit_; - unsigned int moduleStartBit_; - unsigned int sideMask_; - unsigned int layerMask_; - unsigned int trayMask_; - unsigned int moduleMask_; - }; - - struct ETLValues { - unsigned int sideStartBit_; - unsigned int layerStartBit_; - unsigned int ringStartBit_; - unsigned int moduleStartBit_; - unsigned int sideMask_; - unsigned int layerMask_; - unsigned int ringMask_; - unsigned int moduleMask_; - }; - - enum DetIdFields { - BTLModule, - BTLTray, - BTLLayer, - BTLSide, - ETLModule, - ETLRing, - ETLLayer, - ETLSide, - /* TODO: this can be extended for all subdetectors */ - DETID_FIELDS_MAX - }; - - class SameLayerComparator { - public: - explicit SameLayerComparator(const MTDTopology *topo) : topo_(topo) {} - - bool operator()(DetId i1, DetId i2) const { - if (i1.det() == i2.det() && i1.subdetId() == i2.subdetId() && topo_->side(i1) == topo_->side(i2) && - topo_->layer(i1) == topo_->layer(i2)) { - return false; - } - return i1 < i2; - } - - bool operator()(uint32_t i1, uint32_t i2) const { return operator()(DetId(i1), DetId(i2)); } - - private: - const MTDTopology *topo_; - }; - - MTDTopology(const int &topologyMode, const BTLValues &btl, const ETLValues &etl); + MTDTopology(const int &topologyMode); int getMTDTopologyMode() const { return mtdTopologyMode_; } - unsigned int side(const DetId &id) const; - unsigned int layer(const DetId &id) const; - unsigned int module(const DetId &id) const; - unsigned int tray(const DetId &id) const; - unsigned int ring(const DetId &id) const; - - //module - unsigned int btlModule(const DetId &id) const { - return ((id.rawId() >> btlVals_.moduleStartBit_) & btlVals_.moduleMask_); - } - unsigned int etlModule(const DetId &id) const { - return int((id.rawId() >> btlVals_.moduleStartBit_) & btlVals_.moduleMask_); - } - - //tray - unsigned int btlTray(const DetId &id) const { return ((id.rawId() >> btlVals_.trayStartBit_) & btlVals_.trayMask_); } - - // ring id - unsigned int etlRing(const DetId &id) const { return ((id.rawId() >> etlVals_.ringStartBit_) & etlVals_.ringMask_); } - - // layer numbers - unsigned int btlLayer(const DetId &id) const { - return int((id.rawId() >> btlVals_.layerStartBit_) & btlVals_.layerMask_); - } - unsigned int etlLayer(const DetId &id) const { - return int((id.rawId() >> etlVals_.layerStartBit_) & etlVals_.layerMask_); - } - - //side - unsigned int btlSide(const DetId &id) const { return ((id.rawId() >> btlVals_.sideStartBit_) & btlVals_.sideMask_); } - - unsigned int etlSide(const DetId &id) const { return ((id.rawId() >> etlVals_.sideStartBit_) & etlVals_.sideMask_); } - - // which disc is this ring on the forward or backward one? - unsigned int etlDisc(const DetId &id) const { - return int((id.rawId() >> etlVals_.ringStartBit_) & etlVals_.ringMask_) % 2; - } - - //old constructors, now return DetId - DetId btlDetId(uint32_t side, uint32_t layer, uint32_t tray, uint32_t module) const { - //uply - DetId id(DetId::Forward, ForwardSubdetector::FastTime); - uint32_t rawid = id.rawId(); - rawid |= MTDDetId::BTL << MTDDetId::kMTDsubdOffset | (side & btlVals_.sideMask_) << btlVals_.sideStartBit_ | - (layer & btlVals_.layerMask_) << btlVals_.layerStartBit_ | - (tray & btlVals_.trayMask_) << btlVals_.trayStartBit_ | - (module & btlVals_.moduleMask_) << btlVals_.moduleStartBit_; - return DetId(rawid); - } - - DetId etlDetId(uint32_t side, uint32_t layer, uint32_t ring, uint32_t module) const { - DetId id(DetId::Forward, ForwardSubdetector::FastTime); - uint32_t rawid = id.rawId(); - rawid |= MTDDetId::ETL << MTDDetId::kMTDsubdOffset | (side & etlVals_.sideMask_) << etlVals_.sideStartBit_ | - (layer & etlVals_.layerMask_) << etlVals_.layerStartBit_ | - (ring & etlVals_.ringMask_) << etlVals_.ringStartBit_ | - (module & etlVals_.moduleMask_) << etlVals_.moduleStartBit_; - return DetId(rawid); - } - - std::pair btlDetIdLayerComparator(uint32_t side, uint32_t layer) const { - return std::make_pair(btlDetId(side, layer, 1, 1), SameLayerComparator(this)); - } - - std::pair etlDetIdDiskComparator(uint32_t side, uint32_t layer) const { - return std::make_pair(etlDetId(side, layer, 1, 1), SameLayerComparator(this)); - } - - std::string print(DetId detid) const; - - int getMTDLayerNumber(const DetId &id) const; - - // Extract the raw bit value for a given field type. - // E.g. getField(id, PBLadder) == pxbLadder(id) - unsigned int getField(const DetId &id, DetIdFields idx) const { - return ((id.rawId() >> bits_per_field[idx].startBit) & bits_per_field[idx].mask); - } - // checks whether a given field can be extracted from a given DetId. - // This boils down to checking whether it is the correct subdetector. - bool hasField(const DetId &id, DetIdFields idx) const { return id.subdetId() == bits_per_field[idx].subdet; } - private: const int mtdTopologyMode_; - - const BTLValues btlVals_; - const ETLValues etlVals_; - - struct BitmaskAndSubdet { - unsigned int startBit; - unsigned int mask; - int subdet; - }; - const BitmaskAndSubdet bits_per_field[DETID_FIELDS_MAX]; }; #endif diff --git a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc index 10e48cdf244e2..977b21b15c006 100644 --- a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc +++ b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc @@ -1,4 +1,3 @@ -#include "FWCore/Utilities/interface/Exception.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -24,7 +23,7 @@ class MTDTopologyEP : public edm::ESProducer { ReturnType produce(const MTDTopologyRcd&); private: - void fillParameters(const PMTDParameters&, int&, MTDTopology::BTLValues&, MTDTopology::ETLValues&); + void fillParameters(const PMTDParameters&, int& mtdTopologyMode); const edm::ESGetToken token_; }; @@ -39,49 +38,18 @@ void MTDTopologyEP::fillDescriptions(edm::ConfigurationDescriptions& description MTDTopologyEP::ReturnType MTDTopologyEP::produce(const MTDTopologyRcd& iRecord) { int mtdTopologyMode; - MTDTopology::BTLValues btlVals; - MTDTopology::ETLValues etlVals; - fillParameters(iRecord.get(token_), mtdTopologyMode, btlVals, etlVals); + fillParameters(iRecord.get(token_), mtdTopologyMode); - return std::make_unique(mtdTopologyMode, btlVals, etlVals); + return std::make_unique(mtdTopologyMode); } -void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, - int& mtdTopologyMode, - MTDTopology::BTLValues& btlVals, - MTDTopology::ETLValues& etlVals) { +void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMode) { mtdTopologyMode = ptp.topologyMode_; - btlVals.sideStartBit_ = ptp.vitems_[0].vpars_[0]; // 16 - btlVals.layerStartBit_ = ptp.vitems_[0].vpars_[1]; // 16 - btlVals.trayStartBit_ = ptp.vitems_[0].vpars_[2]; // 8 - btlVals.moduleStartBit_ = ptp.vitems_[0].vpars_[3]; // 2 - btlVals.sideMask_ = ptp.vitems_[0].vpars_[4]; // 0xF - btlVals.layerMask_ = ptp.vitems_[0].vpars_[5]; // 0xF - btlVals.trayMask_ = ptp.vitems_[0].vpars_[6]; // 0xFF - btlVals.moduleMask_ = ptp.vitems_[0].vpars_[7]; // 0x3F - - etlVals.sideStartBit_ = ptp.vitems_[1].vpars_[0]; - etlVals.layerStartBit_ = ptp.vitems_[1].vpars_[1]; - etlVals.ringStartBit_ = ptp.vitems_[1].vpars_[2]; - etlVals.moduleStartBit_ = ptp.vitems_[1].vpars_[3]; - etlVals.sideMask_ = ptp.vitems_[1].vpars_[4]; - etlVals.layerMask_ = ptp.vitems_[1].vpars_[5]; - etlVals.ringMask_ = ptp.vitems_[1].vpars_[6]; - etlVals.moduleMask_ = ptp.vitems_[1].vpars_[7]; - #ifdef EDM_ML_DEBUG - edm::LogInfo("MTDTopologyEP") << "Topology mode = " << mtdTopologyMode << "\n" - << "BTL values = " << btlVals.sideStartBit_ << " " << btlVals.layerStartBit_ << " " - << btlVals.trayStartBit_ << " " << btlVals.moduleStartBit_ << " " << std::hex - << btlVals.sideMask_ << " " << std::hex << btlVals.layerMask_ << " " << std::hex - << btlVals.trayMask_ << " " << std::hex << btlVals.moduleMask_ << "\n" - << "ETL values = " << etlVals.sideStartBit_ << " " << etlVals.layerStartBit_ << " " - << etlVals.ringStartBit_ << " " << etlVals.moduleStartBit_ << " " << std::hex - << etlVals.sideMask_ << " " << std::hex << etlVals.layerMask_ << " " << std::hex - << etlVals.ringMask_ << " " << std::hex << etlVals.moduleMask_ << " "; + edm::LogInfo("MTDTopologyEP") << "Topology mode = " << mtdTopologyMode; #endif } diff --git a/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc b/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc index 95d56f831cefa..ea723f87cd821 100644 --- a/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc +++ b/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc @@ -18,7 +18,7 @@ CmsMTDStringToEnum::Impl::Impl() { GeometricTimingDet::GeometricTimingEnumType CmsMTDStringToEnum::type(std::string const& s) const { // remove namespace if present std::string_view v = s; - auto first = v.find_first_of(":"); + auto first = v.find_first_of(':'); v.remove_prefix(std::min(first + 1, v.size())); MapEnumType::const_iterator p = map().find({v.data(), v.size()}); if (p != map().end()) diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 9b5b2eabda8fd..29cbf811a3412 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -1,136 +1,3 @@ #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/ForwardDetId/interface/BTLDetId.h" -#include "DataFormats/ForwardDetId/interface/ETLDetId.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include -#include -MTDTopology::MTDTopology(const int &topologyMode, const BTLValues &btl, const ETLValues &etl) - : mtdTopologyMode_(topologyMode), - btlVals_(btl), - etlVals_(etl), - bits_per_field{[BTLModule] = {btlVals_.moduleStartBit_, btlVals_.moduleMask_, MTDDetId::BTL}, - [BTLTray] = {btlVals_.trayStartBit_, btlVals_.trayMask_, MTDDetId::BTL}, - [BTLLayer] = {btlVals_.layerStartBit_, btlVals_.layerMask_, MTDDetId::BTL}, - [BTLSide] = {btlVals_.sideStartBit_, btlVals_.sideMask_, MTDDetId::BTL}, - [ETLModule] = {etlVals_.moduleStartBit_, etlVals_.moduleMask_, MTDDetId::ETL}, - [ETLRing] = {etlVals_.ringStartBit_, etlVals_.ringMask_, MTDDetId::ETL}, - [ETLLayer] = {etlVals_.layerStartBit_, etlVals_.layerMask_, MTDDetId::ETL}, - [ETLSide] = {etlVals_.sideStartBit_, etlVals_.sideMask_, MTDDetId::ETL}} {} - -unsigned int MTDTopology::side(const DetId &id) const { - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - switch (subdet) { - case MTDDetId::BTL: - return btlSide(id); - case MTDDetId::ETL: - return etlSide(id); - default: - throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::side"; - } - return std::numeric_limits::max(); -} - -unsigned int MTDTopology::layer(const DetId &id) const { - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - switch (subdet) { - case MTDDetId::BTL: - return btlLayer(id); - case MTDDetId::ETL: - return etlLayer(id); - default: - throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::layer"; - } - return std::numeric_limits::max(); -} - -unsigned int MTDTopology::module(const DetId &id) const { - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - switch (subdet) { - case MTDDetId::BTL: - return btlModule(id); - case MTDDetId::ETL: - return etlModule(id); - default: - throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::module"; - } - return std::numeric_limits::max(); -} - -unsigned int MTDTopology::tray(const DetId &id) const { - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - switch (subdet) { - case MTDDetId::BTL: - return btlTray(id); - case MTDDetId::ETL: - return std::numeric_limits::max(); - default: - throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::tray"; - } - return std::numeric_limits::max(); -} - -unsigned int MTDTopology::ring(const DetId &id) const { - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - switch (subdet) { - case MTDDetId::BTL: - return std::numeric_limits::max(); - case MTDDetId::ETL: - return etlModule(id); - default: - throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::ring"; - } - return std::numeric_limits::max(); -} - -std::string MTDTopology::print(DetId id) const { - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - std::stringstream strstr; - - if (subdet == MTDDetId::BTL) { - unsigned int theSide = btlSide(id); - unsigned int theLayer = btlLayer(id); - unsigned int theTray = btlTray(id); - unsigned int theModule = btlModule(id); - std::string side = (btlSide(id) == 1) ? "-" : "+"; - strstr << "BTL" - << " Side " << theSide << side << " Layer " << theLayer << " Tray " << theTray << " Module " - << theModule; - strstr << " (" << id.rawId() << ")"; - return strstr.str(); - } - - if (subdet == MTDDetId::ETL) { - unsigned int theSide = etlSide(id); - unsigned int theLayer = etlLayer(id); - unsigned int theRing = etlRing(id); - unsigned int theModule = etlModule(id); - std::string side = (etlSide(id) == 1) ? "-" : "+"; - strstr << "ETL" - << " Side " << theSide << side << " Layer " << theLayer << " Ring " << theRing << " Module " - << theModule; - strstr << " (" << id.rawId() << ")"; - return strstr.str(); - } - throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::print"; - return strstr.str(); -} - -int MTDTopology::getMTDLayerNumber(const DetId &id) const { - int layer = -1; - uint32_t subdet = MTDDetId(id).mtdSubDetector(); - - if (id.det() == DetId::Forward) { - if (subdet == MTDDetId::BTL) { - layer = btlLayer(id); - } else if (id.subdetId() == MTDDetId::ETL) { - layer = etlLayer(id); - } else { - edm::LogInfo("MTDTopology") << ">>> Invalid subdetId() "; - } - } - return layer; -} +MTDTopology::MTDTopology(const int &topologyMode) : mtdTopologyMode_(topologyMode) {} diff --git a/Geometry/MTDNumberingBuilder/test/BuildFile.xml b/Geometry/MTDNumberingBuilder/test/BuildFile.xml index df9ab7855dc78..daa0757440b7e 100644 --- a/Geometry/MTDNumberingBuilder/test/BuildFile.xml +++ b/Geometry/MTDNumberingBuilder/test/BuildFile.xml @@ -8,31 +8,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc b/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc deleted file mode 100644 index 83e2ef94d716e..0000000000000 --- a/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc +++ /dev/null @@ -1,225 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/Exception.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/DDSpecParRegistryRcd.h" -#include "Geometry/Records/interface/MTDTopologyRcd.h" -#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" - -#include "DetectorDescription/DDCMS/interface/DDDetector.h" -#include "DetectorDescription/DDCMS/interface/DDFilteredView.h" -#include "DetectorDescription/DDCMS/interface/DDSpecParRegistry.h" - -#include "Geometry/MTDCommonData/interface/MTDBaseNumber.h" -#include "Geometry/MTDCommonData/interface/BTLNumberingScheme.h" -#include "Geometry/MTDCommonData/interface/ETLNumberingScheme.h" - -#include "DataFormats/ForwardDetId/interface/BTLDetId.h" -#include "DataFormats/ForwardDetId/interface/ETLDetId.h" - -#include "DataFormats/Math/interface/GeantUnits.h" - -//#define EDM_ML_DEBUG - -using namespace cms; - -class DD4hep_MTDTopologyAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit DD4hep_MTDTopologyAnalyzer(const edm::ParameterSet&); - ~DD4hep_MTDTopologyAnalyzer() = default; - - void beginJob() override {} - void analyze(edm::Event const&, edm::EventSetup const&) override; - void endJob() override {} - - void theBaseNumber(cms::DDFilteredView& fv); - -private: - const edm::ESInputTag tag_; - - MTDBaseNumber thisN_; - BTLNumberingScheme btlNS_; - ETLNumberingScheme etlNS_; - - edm::ESGetToken dddetToken_; - edm::ESGetToken dspecToken_; - edm::ESGetToken mtdtopoToken_; -}; - -DD4hep_MTDTopologyAnalyzer::DD4hep_MTDTopologyAnalyzer(const edm::ParameterSet& iConfig) - : tag_(iConfig.getParameter("DDDetector")), thisN_(), btlNS_(), etlNS_() { - dddetToken_ = esConsumes(tag_); - dspecToken_ = esConsumes(tag_); - mtdtopoToken_ = esConsumes(tag_); -} - -void DD4hep_MTDTopologyAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - auto pDD = iSetup.getTransientHandle(dddetToken_); - - auto pSP = iSetup.getTransientHandle(dspecToken_); - - if (!pDD.isValid()) { - edm::LogError("MTDTopologyAnalyzer") << "ESTransientHandle pDD is not valid!"; - return; - } - if (pDD.description()) { - edm::LogInfo("MTDTopologyAnalyzer") << pDD.description()->type_ << " label: " << pDD.description()->label_; - } else { - edm::LogWarning("MTDTopologyAnalyzer") << "NO label found pDD.description() returned false."; - } - - if (!pSP.isValid()) { - edm::LogError("MTDTopologyAnalyzer") << "ESTransientHandle pSP is not valid!"; - return; - } - - auto pTP = iSetup.getTransientHandle(mtdtopoToken_); - if (!pTP.isValid()) { - edm::LogError("MTDTopologyAnalyzer") << "ESTransientHandle pTP is not valid!"; - return; - } else { - edm::LogInfo("MTDTopologyAnalyzer") << "MTD topology mode = " << pTP->getMTDTopologyMode(); - } - - DDFilteredView fv(pDD.product(), pDD.product()->worldVolume()); - fv.next(0); - edm::LogInfo("MTDTopologyAnalyzer") << fv.name(); - - DDSpecParRefs specs; - std::string attribute("ReadOutName"), name; - // - // Select both BTL and ETL sensitive volumes - // - name = "FastTimerHitsBarrel"; - pSP.product()->filter(specs, attribute, name); - name = "FastTimerHitsEndcap"; - pSP.product()->filter(specs, attribute, name); - - edm::LogVerbatim("Geometry").log([&specs](auto& log) { - log << "Filtered DD SpecPar Registry size: " << specs.size() << "\n"; - for (const auto& t : specs) { - log << "\nRegExps { "; - for (const auto& ki : t.second->paths) - log << ki << " "; - log << "};\n "; - for (const auto& kl : t.second->spars) { - log << kl.first << " = "; - for (const auto& kil : kl.second) { - log << kil << " "; - } - log << "\n "; - } - } - }); - - bool isBarrel = true; - std::string ddtop(""); - uint32_t level(0); - - do { - if (fv.name() == "BarrelTimingLayer") { - isBarrel = true; - ddtop = "BarrelTimingLayer"; - edm::LogInfo("MTDTopologyAnalyzer") << "isBarrel = " << isBarrel; - } else if (fv.name() == "EndcapTimingLayer") { - isBarrel = false; - ddtop = "EndcapTimingLayer"; - edm::LogInfo("MTDTopologyAnalyzer") << "isBarrel = " << isBarrel; - } - -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("MTDTopologyAnalyzer") << "Top level volume: " << ddtop; -#endif - - std::stringstream ss; - - theBaseNumber(fv); - - auto print_path = [&]() { - ss << " - OCMS[0]/"; - for (int ii = thisN_.getLevels() - 1; ii-- > 0;) { - ss << thisN_.getLevelName(ii); - ss << "["; - ss << thisN_.getCopyNumber(ii); - ss << "]/"; - } - }; - - if (level > 0 && fv.copyNos().size() < level) { - level = 0; - ddtop.clear(); - } - if (fv.name() == "BarrelTimingLayer" || fv.name() == "EndcapTimingLayer") { - level = fv.copyNos().size(); - } - - if (!ddtop.empty()) { - // Actions for MTD topology test: searchg for sensitive detectors - - print_path(); - -#ifdef EDM_ML_DEBUG - edm::LogInfo("MTDTopologyAnalyzer") << "Top level volume: " << ddtop << " at history " << ss.str(); -#endif - - bool isSens = false; - - for (auto const& t : specs) { - for (auto const& it : t.second->paths) { - if (dd4hep::dd::compareEqual(fv.name(), dd4hep::dd::realTopName(it))) { - isSens = true; - break; - } - } - } - - if (isSens) { - // - // Test of numbering scheme for sensitive detectors - // - - edm::LogVerbatim("MTDTopologyanalyzer") << ss.str(); - - if (isBarrel) { - BTLDetId theId(btlNS_.getUnitID(thisN_)); - DetId localId(theId.rawId()); - edm::LogVerbatim("MTDTopologAnalyzer") << pTP->print(localId) << "\n" << theId; - } else { - ETLDetId theId(etlNS_.getUnitID(thisN_)); - DetId localId(theId.rawId()); - edm::LogVerbatim("MTDTopologAnalyzer") << pTP->print(localId) << "\n" << theId; - } - } - } - } while (fv.next(0)); -} - -void DD4hep_MTDTopologyAnalyzer::theBaseNumber(cms::DDFilteredView& fv) { - thisN_.reset(); - thisN_.setSize(fv.copyNos().size()); - - for (uint ii = 0; ii < fv.copyNos().size(); ii++) { - std::string name(dd4hep::dd::noNamespace((fv.geoHistory()[ii])->GetName())); - name.assign(name.erase(name.rfind('_'))); - int copyN(fv.copyNos()[ii]); - thisN_.addLevel(name, copyN); -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("MTDTopologyAnalyzer") << name << " " << copyN; -#endif - } -} - -DEFINE_FWK_MODULE(DD4hep_MTDTopologyAnalyzer); diff --git a/Geometry/MTDNumberingBuilder/test/GeometricTimingDetAnalyzer.cc b/Geometry/MTDNumberingBuilder/test/GeometricTimingDetAnalyzer.cc index 894939f23f7d2..029e5af079fc7 100644 --- a/Geometry/MTDNumberingBuilder/test/GeometricTimingDetAnalyzer.cc +++ b/Geometry/MTDNumberingBuilder/test/GeometricTimingDetAnalyzer.cc @@ -57,6 +57,9 @@ class GeometricTimingDetAnalyzer : public edm::one::EDAnalyzer<> { void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; void endJob() override {} void dumpGeometricTimingDet(const GeometricTimingDet* det); + +private: + edm::ESGetToken gtdToken_; }; // @@ -71,7 +74,7 @@ class GeometricTimingDetAnalyzer : public edm::one::EDAnalyzer<> { // constructors and destructor // GeometricTimingDetAnalyzer::GeometricTimingDetAnalyzer(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed + gtdToken_ = esConsumes(); } GeometricTimingDetAnalyzer::~GeometricTimingDetAnalyzer() { @@ -93,11 +96,10 @@ void GeometricTimingDetAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev // // get the GeometricTimingDet // - edm::ESHandle rDD; - iSetup.get().get(rDD); + auto rDD = iSetup.getTransientHandle(gtdToken_); if (!rDD.isValid()) { - edm::LogError("DD4hep_MTDTopologyAnalyzer") << "ESTransientHandle rDD is not valid!"; + edm::LogError("GeometricTimingDetAnalyzer") << "ESTransientHandle rDD is not valid!"; return; } diff --git a/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc b/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc deleted file mode 100644 index d2e5a46474568..0000000000000 --- a/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc +++ /dev/null @@ -1,190 +0,0 @@ - -// system include files -#include - -// 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/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "Geometry/Records/interface/MTDTopologyRcd.h" -#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" - -#include "DetectorDescription/Core/interface/DDFilteredView.h" - -#include "Geometry/MTDCommonData/interface/MTDBaseNumber.h" -#include "Geometry/MTDCommonData/interface/BTLNumberingScheme.h" -#include "Geometry/MTDCommonData/interface/ETLNumberingScheme.h" - -#include "DataFormats/ForwardDetId/interface/BTLDetId.h" -#include "DataFormats/ForwardDetId/interface/ETLDetId.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -//#define EDM_ML_DEBUG - -// -// class declaration -// - -class MTDTopologyAnalyzer : public edm::one::EDAnalyzer<> { -public: - explicit MTDTopologyAnalyzer(const edm::ParameterSet&); - ~MTDTopologyAnalyzer() override = default; - - void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; - - void theBaseNumber(const DDGeoHistory& gh); - - std::string noNSgeoHistory(const DDGeoHistory& gh); - - MTDBaseNumber thisN_; - BTLNumberingScheme btlNS_; - ETLNumberingScheme etlNS_; -}; - -MTDTopologyAnalyzer::MTDTopologyAnalyzer(const edm::ParameterSet& iConfig) : thisN_(), btlNS_(), etlNS_() {} - -// ------------ method called to produce the data ------------ -void MTDTopologyAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle mtdTopo; - iSetup.get().get(mtdTopo); - edm::LogInfo("MTDTopologyAnalyzer") << "MTD topology mode = " << mtdTopo->getMTDTopologyMode(); - - // Build DetIds based on DD description, then extract information from topology and compare - - std::string label; - - edm::ESTransientHandle pDD; - iSetup.get().get(label, pDD); - if (pDD.description()) { - edm::LogInfo("MTDTopologyAnalyzer") << pDD.description()->type_ << " label: " << pDD.description()->label_; - } else { - edm::LogWarning("MTDTopologyAnalyzer") << "NO label found pDD.description() returned false."; - } - if (!pDD.isValid()) { - edm::LogError("MTDTopologyAnalyzer") << "ESTransientHandle pDD is not valid!"; - } - - DDPassAllFilter filter; - DDFilteredView fv(*pDD, filter); - - edm::LogInfo("MTDTopologyAnalyzer") << "Top Most LogicalPart = " << fv.logicalPart(); - - using nav_type = DDFilteredView::nav_type; - using id_type = std::map; - id_type idMap; - int id = 0; - std::string ddtop(""); - size_t limit = 0; - - bool isBarrel = false; - - do { - nav_type pos = fv.navPos(); - idMap[pos] = id; - - size_t num = fv.geoHistory().size(); - - if (fv.geoHistory()[num - 1].logicalPart().name().name() == "BarrelTimingLayer") { - isBarrel = true; - limit = num; - ddtop = "BarrelTimingLayer"; - } else if (fv.geoHistory()[num - 1].logicalPart().name().name() == "EndcapTimingLayer") { - isBarrel = false; - limit = num; - ddtop = "EndcapTimingLayer"; - } - -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("MTDTopologyAnalyzer") << "Top level volume: " << ddtop; -#endif - - if (num <= limit && fv.geoHistory()[num - 1].logicalPart().name().name() != ddtop) { - ddtop.clear(); - } - -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("MTDTopologyAnalyzer") - << "Top level volume: " << ddtop << " at history " << fv.geoHistory()[num - 1].logicalPart().name().name(); -#endif - - if (!ddtop.empty()) { - // Actions for MTD volumes: searchg for sensitive detectors - - bool isSens = false; - - if (fv.geoHistory()[num - 1].logicalPart().specifics().size() > 0) { - for (auto vec : fv.geoHistory()[num - 1].logicalPart().specifics()) { - for (auto elem : *vec) { - if (elem.second.name() == "SensitiveDetector") { - isSens = true; - break; - } - } - } - } - - // Check of numbering scheme for sensitive detectors - - if (isSens) { - theBaseNumber(fv.geoHistory()); - - edm::LogVerbatim("MTDTopologyAnalyzer") << noNSgeoHistory(fv.geoHistory()); - - if (isBarrel) { - BTLDetId theId(btlNS_.getUnitID(thisN_)); - DetId localId(theId.rawId()); - edm::LogVerbatim("MTDTopologAnalyzer") << mtdTopo->print(localId) << "\n" << theId; - ; - } else { - ETLDetId theId(etlNS_.getUnitID(thisN_)); - DetId localId(theId.rawId()); - edm::LogVerbatim("MTDTopologAnalyzer") << mtdTopo->print(localId) << "\n" << theId; - ; - } - } - } - - ++id; - } while (fv.next()); -} - -void MTDTopologyAnalyzer::theBaseNumber(const DDGeoHistory& gh) { - thisN_.reset(); - thisN_.setSize(gh.size()); - - for (uint i = gh.size(); i-- > 0;) { - std::string name(gh[i].logicalPart().name().name()); - int copyN(gh[i].copyno()); - thisN_.addLevel(name, copyN); -#ifdef EDM_ML_DEBUG - edm::LogInfo("MTDTopologyAnalyzer") << name << " " << copyN; -#endif - } -} - -std::string MTDTopologyAnalyzer::noNSgeoHistory(const DDGeoHistory& gh) { - std::string output(" - "); - for (uint i = 0; i < gh.size(); i++) { - output += gh[i].logicalPart().name().name(); - output += "["; - output += std::to_string(gh[i].copyno()); - output += "]/"; - } - -#ifdef EDM_ML_DEBUG - edm::LogInfo("MTDTopologyAnalyzer") << output; -#endif - - return output; -} - -//define this as a plug-in -DEFINE_FWK_MODULE(MTDTopologyAnalyzer); diff --git a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py index b518eab748b7a..0c584413b0025 100644 --- a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py @@ -25,9 +25,6 @@ INFO = cms.untracked.PSet( limit = cms.untracked.int32(-1) ), - MTDTopologyAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), enable = cms.untracked.bool(True), enableStatistics = cms.untracked.bool(True), noLineBreaks = cms.untracked.bool(True), @@ -79,10 +76,6 @@ process.prod = cms.EDAnalyzer("GeometricTimingDetAnalyzer") -process.prod1 = cms.EDAnalyzer("DD4hep_MTDTopologyAnalyzer", - DDDetector = cms.ESInputTag('',''), -) - process.Timing = cms.Service("Timing") -process.p1 = cms.Path(process.prod+process.prod1) +process.p1 = cms.Path(process.prod) diff --git a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py index 822dbb2de30dd..86a0aa63c58fc 100644 --- a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py @@ -27,9 +27,6 @@ INFO = cms.untracked.PSet( limit = cms.untracked.int32(-1) ), - MTDTopologyAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), enable = cms.untracked.bool(True), enableStatistics = cms.untracked.bool(True), noLineBreaks = cms.untracked.bool(True), @@ -72,7 +69,5 @@ process.prod = cms.EDAnalyzer("GeometricTimingDetAnalyzer") -process.prod1 = cms.EDAnalyzer("MTDTopologyAnalyzer") - -process.p1 = cms.Path(process.prod+process.prod1) +process.p1 = cms.Path(process.prod) diff --git a/Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml b/Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml new file mode 100644 index 0000000000000..d1da16e919ea8 --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/v1/RP_Horizontal_Device.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml b/Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml new file mode 100644 index 0000000000000..913f906d4504d --- /dev/null +++ b/Geometry/VeryForwardData/data/RP_Vertical_Device/2021/v1/RP_Vertical_Device.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HLTrigger/Configuration/python/CustomConfigs.py b/HLTrigger/Configuration/python/CustomConfigs.py index dc6aee187b6d2..c2168dbb28f87 100644 --- a/HLTrigger/Configuration/python/CustomConfigs.py +++ b/HLTrigger/Configuration/python/CustomConfigs.py @@ -200,3 +200,8 @@ def L1XML(process,xmlFile=None): process.ESPreferL1TXML = cms.ESPrefer("L1TUtmTriggerMenuESProducer","L1TriggerMenu") return process + +def CTPPSRun2Geometry(process): + if hasattr(process,'ctppsGeometryESModule'): + process.ctppsGeometryESModule.isRun2 = True + return(process) diff --git a/HLTrigger/Configuration/test/cmsDriver.csh b/HLTrigger/Configuration/test/cmsDriver.csh index 73cccd0166628..333f240b76858 100755 --- a/HLTrigger/Configuration/test/cmsDriver.csh +++ b/HLTrigger/Configuration/test/cmsDriver.csh @@ -253,6 +253,10 @@ foreach gtag ( MC DATA ) continue endif + ## Force CTPPSRun2Geometry if running on Run-2 data using Run3 modifier + if ( $gtag == DATA && ( $Era == $EraRun3HI || $Era == $EraRun3pp) ) then + set Custom = "HLTrigger/Configuration/CustomConfigs.CTPPSRun2Geometry" + endif if ( $gtag == DATA ) then @@ -320,9 +324,11 @@ EOF else set STEPS = "RAW2DIGI,L1Reco,RECO,EI,PAT,DQM" endif + set CustomCommand = "--customise_commands=process.valCscStage2Digis.GEMPadDigiClusterProducer='';process.valCscStage2Digis.commonParam=dict(runME11ILT=False)" + echo echo "Creating RECO+EI+PAT+DQM $name" - cmsDriver.py RelVal --step=$STEPS --conditions=$RTAG --filein=file:RelVal_HLT_$name.root --custom_conditions=$XL1T --fileout=RelVal_RECO_$name.root --number=$NN $DATAMC --no_exec --datatier 'RECO,MINIAOD,DQMIO' --eventcontent=RECO,MINIAOD,DQM --customise=HLTrigger/Configuration/CustomConfigs.Base $Era --customise=$Custom --scenario=$SCEN --python_filename=RelVal_RECO_$name.py --processName=$RNAME + cmsDriver.py RelVal --step=$STEPS --conditions=$RTAG --filein=file:RelVal_HLT_$name.root --custom_conditions=$XL1T --fileout=RelVal_RECO_$name.root --number=$NN $DATAMC --no_exec --datatier 'RECO,MINIAOD,DQMIO' --eventcontent=RECO,MINIAOD,DQM --customise=HLTrigger/Configuration/CustomConfigs.Base $Era --customise=$Custom --scenario=$SCEN --python_filename=RelVal_RECO_$name.py --processName=$RNAME $CustomCommand else diff --git a/HLTrigger/HLTcore/interface/TriggerExpressionData.h b/HLTrigger/HLTcore/interface/TriggerExpressionData.h index 1d23f3a8f9180..f45158cdb670a 100644 --- a/HLTrigger/HLTcore/interface/TriggerExpressionData.h +++ b/HLTrigger/HLTcore/interface/TriggerExpressionData.h @@ -4,6 +4,8 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/DataRecord/interface/L1TUtmTriggerMenuRcd.h" +#include "CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h" #include "DataFormats/Provenance/interface/ParameterSetID.h" #include "DataFormats/Provenance/interface/EventID.h" #include "DataFormats/Common/interface/TriggerResults.h" @@ -15,8 +17,6 @@ namespace edm { class TriggerNames; } // namespace edm -class L1TUtmTriggerMenu; - namespace triggerExpression { class Data { @@ -28,6 +28,7 @@ namespace triggerExpression { m_hltResultsToken(), m_l1tResultsTag(""), m_l1tResultsToken(), + m_l1tUtmTriggerMenuToken(), m_l1tIgnoreMaskAndPrescale(false), m_throw(true), // l1 values and status @@ -50,6 +51,7 @@ namespace triggerExpression { m_hltResultsToken(), m_l1tResultsTag(config.getParameter("l1tResults")), m_l1tResultsToken(), + m_l1tUtmTriggerMenuToken(iC.esConsumes()), m_l1tIgnoreMaskAndPrescale(config.getParameter("l1tIgnoreMaskAndPrescale")), m_throw(config.getParameter("throw")), // l1 values and status @@ -81,6 +83,7 @@ namespace triggerExpression { m_hltResultsToken(), m_l1tResultsTag(l1tResultsTag), m_l1tResultsToken(), + m_l1tUtmTriggerMenuToken(iC.esConsumes()), m_l1tIgnoreMaskAndPrescale(l1tIgnoreMaskAndPrescale), m_throw(doThrow), // l1 values and status @@ -147,6 +150,7 @@ namespace triggerExpression { edm::EDGetTokenT m_hltResultsToken; edm::InputTag m_l1tResultsTag; edm::EDGetTokenT m_l1tResultsToken; + edm::ESGetToken const m_l1tUtmTriggerMenuToken; bool m_l1tIgnoreMaskAndPrescale; bool m_throw; diff --git a/HLTrigger/HLTcore/src/TriggerExpressionData.cc b/HLTrigger/HLTcore/src/TriggerExpressionData.cc index 51e0dec58ff97..5d7c949b22393 100644 --- a/HLTrigger/HLTcore/src/TriggerExpressionData.cc +++ b/HLTrigger/HLTcore/src/TriggerExpressionData.cc @@ -1,5 +1,3 @@ - - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -9,8 +7,6 @@ #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h" -#include "CondFormats/DataRecord/interface/L1TUtmTriggerMenuRcd.h" -#include "CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h" #include "HLTrigger/HLTcore/interface/TriggerExpressionData.h" namespace triggerExpression { @@ -37,7 +33,7 @@ namespace triggerExpression { if (m_l1tCacheID == l1tCacheID) { m_l1tUpdated = false; } else { - m_l1tMenu = &edm::get(setup); + m_l1tMenu = &setup.getData(m_l1tUtmTriggerMenuToken); m_l1tCacheID = l1tCacheID; m_l1tUpdated = true; } diff --git a/HLTrigger/special/plugins/HLTPPSPerPotTrackFilter.cc b/HLTrigger/special/plugins/HLTPPSPerPotTrackFilter.cc new file mode 100644 index 0000000000000..2eef587335a49 --- /dev/null +++ b/HLTrigger/special/plugins/HLTPPSPerPotTrackFilter.cc @@ -0,0 +1,192 @@ +// Laurent Forthomme +// lforthom@cern.ch +// 2020-02-17 +// +// HLT filter module to select events with tracks in the PPS detector +// + +#include "FWCore/Framework/interface/global/EDFilter.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/DetSet.h" +#include "DataFormats/Common/interface/DetSetVector.h" + +#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" + +#include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" // pixel +#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" // strip +#include "DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h" // diamond + +#include + +class HLTPPSPerPotTrackFilter : public edm::global::EDFilter<> { +public: + explicit HLTPPSPerPotTrackFilter(const edm::ParameterSet&); + ~HLTPPSPerPotTrackFilter() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions&); + bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + +private: + edm::EDGetTokenT> pixelLocalTrackToken_; + edm::EDGetTokenT> stripLocalTrackToken_; + edm::EDGetTokenT> diamondLocalTrackToken_; + + struct PerPotFilter { + int minTracks; + int maxTracks; + }; + std::unordered_map pixel_filter_; + std::unordered_map strip_filter_; + std::unordered_map diam_filter_; + + // Helper tool to count valid tracks + static constexpr auto valid_trks_ = [](const auto& trk) { return trk.isValid(); }; +}; + +void HLTPPSPerPotTrackFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("pixelLocalTrackInputTag", edm::InputTag("ctppsPixelLocalTracks")) + ->setComment("input tag of the pixel local track collection"); + desc.add("stripLocalTrackInputTag", edm::InputTag("totemRPLocalTrackFitter")) + ->setComment("input tag of the strip local track collection"); + desc.add("diamondLocalTrackInputTag", edm::InputTag("ctppsDiamondLocalTracks")) + ->setComment("input tag of the diamond local track collection"); + + edm::ParameterSetDescription filterValid; + filterValid.add("detid", 0)->setComment("station/pot raw DetId"); + filterValid.add("minTracks", -1)->setComment("minimum number of tracks in pot"); + filterValid.add("maxTracks", -1)->setComment("maximum number of tracks in pot"); + + std::vector vPixelDefault; + auto& near_pix45 = vPixelDefault.emplace_back(); + near_pix45.addParameter("detid", CTPPSPixelDetId(0, 2, 2)); // arm-station-rp + near_pix45.addParameter("minTracks", 2); + near_pix45.addParameter("maxTracks", -1); + auto& far_pix45 = vPixelDefault.emplace_back(); + far_pix45.addParameter("detid", CTPPSPixelDetId(0, 2, 3)); // arm-station-rp + far_pix45.addParameter("minTracks", 2); + far_pix45.addParameter("maxTracks", -1); + auto& near_pix56 = vPixelDefault.emplace_back(); + near_pix56.addParameter("detid", CTPPSPixelDetId(1, 2, 2)); // arm-station-rp + near_pix56.addParameter("minTracks", 2); + near_pix56.addParameter("maxTracks", -1); + auto& far_pix56 = vPixelDefault.emplace_back(); + far_pix56.addParameter("detid", CTPPSPixelDetId(1, 2, 3)); // arm-station-rp + far_pix56.addParameter("minTracks", 2); + far_pix56.addParameter("maxTracks", -1); + desc.addVPSet("pixelFilter", filterValid, vPixelDefault); + + std::vector vStripDefault; + desc.addVPSet("stripFilter", filterValid, vStripDefault); + + std::vector vDiamDefault; + desc.addVPSet("diamondFilter", filterValid, vDiamDefault); + + desc.add("triggerType", trigger::TriggerTrack); + + descriptions.add("hltPPSPerPotTrackFilter", desc); +} + +HLTPPSPerPotTrackFilter::HLTPPSPerPotTrackFilter(const edm::ParameterSet& iConfig) { + // First define pixels (2017+) selection + const auto& pixelVPset = iConfig.getParameter>("pixelFilter"); + if (!pixelVPset.empty()) { + pixelLocalTrackToken_ = consumes>( + iConfig.getParameter("pixelLocalTrackInputTag")); + for (const auto& pset : pixelVPset) + pixel_filter_[pset.getParameter("detid")] = + PerPotFilter{pset.getParameter("minTracks"), pset.getParameter("maxTracks")}; + } + // Then define strips (2016-17) selection + const auto& stripVPset = iConfig.getParameter>("stripFilter"); + if (!stripVPset.empty()) { + stripLocalTrackToken_ = + consumes>(iConfig.getParameter("stripLocalTrackInputTag")); + for (const auto& pset : stripVPset) + strip_filter_[pset.getParameter("detid")] = + PerPotFilter{pset.getParameter("minTracks"), pset.getParameter("maxTracks")}; + } + // Finally define diamond (2016+) selection + const auto& diamVPset = iConfig.getParameter>("diamondFilter"); + if (!diamVPset.empty()) { + diamondLocalTrackToken_ = consumes>( + iConfig.getParameter("diamondLocalTrackInputTag")); + for (const auto& pset : diamVPset) + diam_filter_[pset.getParameter("detid")] = + PerPotFilter{pset.getParameter("minTracks"), pset.getParameter("maxTracks")}; + } +} + +bool HLTPPSPerPotTrackFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + // First filter on pixels + if (!pixel_filter_.empty()) { + edm::Handle> pixelTracks; + iEvent.getByToken(pixelLocalTrackToken_, pixelTracks); + + for (const auto& rpv : *pixelTracks) { + if (pixel_filter_.count(rpv.id) == 0) + continue; + const auto& fltr = pixel_filter_.at(rpv.id); + + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks_); + if (fltr.minTracks > 0 && ntrks < fltr.minTracks) + return false; + if (fltr.maxTracks > 0 && ntrks > fltr.maxTracks) + return false; + } + } + + // Then filter on strips + if (!strip_filter_.empty()) { + edm::Handle> stripTracks; + iEvent.getByToken(stripLocalTrackToken_, stripTracks); + + for (const auto& rpv : *stripTracks) { + if (strip_filter_.count(rpv.id) == 0) + continue; + const auto& fltr = strip_filter_.at(rpv.id); + + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks_); + if (fltr.minTracks > 0 && ntrks < fltr.minTracks) + return false; + if (fltr.maxTracks > 0 && ntrks > fltr.maxTracks) + return false; + } + } + + // Finally filter on diamond + if (!diam_filter_.empty()) { + edm::Handle> diamondTracks; + iEvent.getByToken(diamondLocalTrackToken_, diamondTracks); + + for (const auto& rpv : *diamondTracks) { + if (diam_filter_.count(rpv.id) == 0) + continue; + const auto& fltr = diam_filter_.at(rpv.id); + + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks_); + if (fltr.minTracks > 0 && ntrks < fltr.minTracks) + return false; + if (fltr.maxTracks > 0 && ntrks > fltr.maxTracks) + return false; + } + } + + return true; +} + +// define as a framework module +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(HLTPPSPerPotTrackFilter); diff --git a/HLTrigger/special/plugins/HLTRechitsToDigis.cc b/HLTrigger/special/plugins/HLTRechitsToDigis.cc index e2c221fe75487..69673dd6ef082 100644 --- a/HLTrigger/special/plugins/HLTRechitsToDigis.cc +++ b/HLTrigger/special/plugins/HLTRechitsToDigis.cc @@ -63,6 +63,8 @@ class HLTRechitsToDigis : public edm::stream::EDProducer<> { edm::EDGetTokenT srFlagsEBInToken_; edm::EDGetTokenT srFlagsEEInToken_; + EcalReadoutTools::ESGetTokens const ecalReadoutToolsESGetTokens_; + // input tags edm::InputTag digisIn_; edm::InputTag recHits_; @@ -80,7 +82,8 @@ class HLTRechitsToDigis : public edm::stream::EDProducer<> { // // constructors and destructor // -HLTRechitsToDigis::HLTRechitsToDigis(const edm::ParameterSet& iConfig) { +HLTRechitsToDigis::HLTRechitsToDigis(const edm::ParameterSet& iConfig) + : ecalReadoutToolsESGetTokens_{iConfig, consumesCollector()} { //region to do rechit digi matching region_ = stringToRegion(iConfig.getParameter("region")); @@ -157,7 +160,7 @@ void HLTRechitsToDigis::produce(edm::Event& iEvent, edm::EventSetup const& setup // output collections std::unique_ptr outputEBSrFlagCollection(new EBSrFlagCollection); std::unique_ptr outputEESrFlagCollection(new EESrFlagCollection); - EcalReadoutTools ecalReadOutTool(iEvent, setup); + EcalReadoutTools ecalReadOutTool(iEvent, setup, ecalReadoutToolsESGetTokens_); // calibrated rechits Handle recHitsHandle; diff --git a/HeterogeneousCore/CUDAUtilities/interface/FlexiStorage.h b/HeterogeneousCore/CUDAUtilities/interface/FlexiStorage.h new file mode 100644 index 0000000000000..f794fb53afe4d --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/interface/FlexiStorage.h @@ -0,0 +1,49 @@ +#ifndef HeterogeneousCore_CUDAUtilities_interface_FlexiStorage_h +#define HeterogeneousCore_CUDAUtilities_interface_FlexiStorage_h + +#include + +namespace cms { + namespace cuda { + + template + class FlexiStorage { + public: + constexpr int capacity() const { return S; } + + constexpr I& operator[](int i) { return m_v[i]; } + constexpr const I& operator[](int i) const { return m_v[i]; } + + constexpr I* data() { return m_v; } + constexpr I const* data() const { return m_v; } + + private: + I m_v[S]; + }; + + template + class FlexiStorage { + public: + constexpr void init(I* v, int s) { + m_v = v; + m_capacity = s; + } + + constexpr int capacity() const { return m_capacity; } + + constexpr I& operator[](int i) { return m_v[i]; } + constexpr const I& operator[](int i) const { return m_v[i]; } + + constexpr I* data() { return m_v; } + constexpr I const* data() const { return m_v; } + + private: + I* m_v; + int m_capacity; + }; + + } // namespace cuda + +} // namespace cms + +#endif diff --git a/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h b/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h index bd80281f75333..7bf5db603bccd 100644 --- a/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h +++ b/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h @@ -1,19 +1,7 @@ #ifndef HeterogeneousCore_CUDAUtilities_interface_HistoContainer_h #define HeterogeneousCore_CUDAUtilities_interface_HistoContainer_h -#include -#ifndef __CUDA_ARCH__ -#include -#endif // __CUDA_ARCH__ -#include -#include -#include - -#include "HeterogeneousCore/CUDAUtilities/interface/AtomicPairCounter.h" -#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" -#include "HeterogeneousCore/CUDAUtilities/interface/cuda_assert.h" -#include "HeterogeneousCore/CUDAUtilities/interface/cudastdAlgorithm.h" -#include "HeterogeneousCore/CUDAUtilities/interface/prefixScan.h" +#include "HeterogeneousCore/CUDAUtilities/interface/OneToManyAssoc.h" namespace cms { namespace cuda { @@ -50,61 +38,27 @@ namespace cms { } } - template - inline __attribute__((always_inline)) void launchZero(Histo *__restrict__ h, - cudaStream_t stream -#ifndef __CUDACC__ - = cudaStreamDefault -#endif - ) { - uint32_t *poff = (uint32_t *)((char *)(h) + offsetof(Histo, off)); - int32_t size = offsetof(Histo, bins) - offsetof(Histo, off); - assert(size >= int(sizeof(uint32_t) * Histo::totbins())); -#ifdef __CUDACC__ - cudaCheck(cudaMemsetAsync(poff, 0, size, stream)); -#else - ::memset(poff, 0, size); -#endif - } - - template - inline __attribute__((always_inline)) void launchFinalize(Histo *__restrict__ h, - cudaStream_t stream -#ifndef __CUDACC__ - = cudaStreamDefault -#endif - ) { -#ifdef __CUDACC__ - uint32_t *poff = (uint32_t *)((char *)(h) + offsetof(Histo, off)); - int32_t *ppsws = (int32_t *)((char *)(h) + offsetof(Histo, psws)); - auto nthreads = 1024; - auto nblocks = (Histo::totbins() + nthreads - 1) / nthreads; - multiBlockPrefixScan<<>>( - poff, poff, Histo::totbins(), ppsws); - cudaCheck(cudaGetLastError()); -#else - h->finalize(); -#endif - } - template inline __attribute__((always_inline)) void fillManyFromVector(Histo *__restrict__ h, uint32_t nh, T const *__restrict__ v, uint32_t const *__restrict__ offsets, - uint32_t totSize, + int32_t totSize, int nthreads, + typename Histo::index_type *mem, cudaStream_t stream #ifndef __CUDACC__ = cudaStreamDefault #endif ) { - launchZero(h, stream); + typename Histo::View view = {h, nullptr, mem, -1, totSize}; + launchZero(view, stream); #ifdef __CUDACC__ auto nblocks = (totSize + nthreads - 1) / nthreads; + assert(nblocks > 0); countFromVector<<>>(h, nh, v, offsets); cudaCheck(cudaGetLastError()); - launchFinalize(h, stream); + launchFinalize(view, stream); fillFromVector<<>>(h, nh, v, offsets); cudaCheck(cudaGetLastError()); #else @@ -114,11 +68,6 @@ namespace cms { #endif } - template - __global__ void finalizeBulk(AtomicPairCounter const *apc, Assoc *__restrict__ assoc) { - assoc->bulkFinalizeFill(*apc); - } - // iteratate over N bins left and right of the one containing "v" template __host__ __device__ __forceinline__ void forEachInBins(Hist const &hist, V value, int n, Func func) { @@ -142,20 +91,19 @@ namespace cms { } } - template - class HistoContainer { + class HistoContainer : public OneToManyAssoc { public: - using Counter = uint32_t; - - using CountersOnly = HistoContainer; - - using index_type = I; + using Base = OneToManyAssoc; + using View = typename Base::View; + using Counter = typename Base::Counter; + using index_type = typename Base::index_type; using UT = typename std::make_unsigned::type; static constexpr uint32_t ilog2(uint32_t v) { @@ -176,7 +124,8 @@ namespace cms { static constexpr uint32_t nhists() { return NHISTS; } static constexpr uint32_t totbins() { return NHISTS * NBINS + 1; } static constexpr uint32_t nbits() { return ilog2(NBINS - 1) + 1; } - static constexpr uint32_t capacity() { return SIZE; } + + // static_assert(int32_t(totbins())==Base::ctNOnes()); static constexpr auto histOff(uint32_t nh) { return NBINS * nh; } @@ -186,91 +135,18 @@ namespace cms { return (t >> shift) & mask; } - __host__ __device__ void zero() { - for (auto &i : off) - i = 0; - } - - __host__ __device__ __forceinline__ void add(CountersOnly const &co) { - for (uint32_t i = 0; i < totbins(); ++i) { -#ifdef __CUDA_ARCH__ - atomicAdd(off + i, co.off[i]); -#else - auto &a = (std::atomic &)(off[i]); - a += co.off[i]; -#endif - } - } - - static __host__ __device__ __forceinline__ uint32_t atomicIncrement(Counter &x) { -#ifdef __CUDA_ARCH__ - return atomicAdd(&x, 1); -#else - auto &a = (std::atomic &)(x); - return a++; -#endif - } - - static __host__ __device__ __forceinline__ uint32_t atomicDecrement(Counter &x) { -#ifdef __CUDA_ARCH__ - return atomicSub(&x, 1); -#else - auto &a = (std::atomic &)(x); - return a--; -#endif - } - - __host__ __device__ __forceinline__ void countDirect(T b) { - assert(b < nbins()); - atomicIncrement(off[b]); - } - - __host__ __device__ __forceinline__ void fillDirect(T b, index_type j) { - assert(b < nbins()); - auto w = atomicDecrement(off[b]); - assert(w > 0); - bins[w - 1] = j; - } - - __host__ __device__ __forceinline__ int32_t bulkFill(AtomicPairCounter &apc, index_type const *v, uint32_t n) { - auto c = apc.add(n); - if (c.m >= nbins()) - return -int32_t(c.m); - off[c.m] = c.n; - for (uint32_t j = 0; j < n; ++j) - bins[c.n + j] = v[j]; - return c.m; - } - - __host__ __device__ __forceinline__ void bulkFinalize(AtomicPairCounter const &apc) { - off[apc.get().m] = apc.get().n; - } - - __host__ __device__ __forceinline__ void bulkFinalizeFill(AtomicPairCounter const &apc) { - auto m = apc.get().m; - auto n = apc.get().n; - if (m >= nbins()) { // overflow! - off[nbins()] = uint32_t(off[nbins() - 1]); - return; - } - auto first = m + blockDim.x * blockIdx.x + threadIdx.x; - for (auto i = first; i < totbins(); i += gridDim.x * blockDim.x) { - off[i] = n; - } - } - __host__ __device__ __forceinline__ void count(T t) { uint32_t b = bin(t); assert(b < nbins()); - atomicIncrement(off[b]); + Base::atomicIncrement(this->off[b]); } __host__ __device__ __forceinline__ void fill(T t, index_type j) { uint32_t b = bin(t); assert(b < nbins()); - auto w = atomicDecrement(off[b]); + auto w = Base::atomicDecrement(this->off[b]); assert(w > 0); - bins[w - 1] = j; + this->content[w - 1] = j; } __host__ __device__ __forceinline__ void count(T t, uint32_t nh) { @@ -278,7 +154,7 @@ namespace cms { assert(b < nbins()); b += histOff(nh); assert(b < totbins()); - atomicIncrement(off[b]); + Base::atomicIncrement(this->off[b]); } __host__ __device__ __forceinline__ void fill(T t, index_type j, uint32_t nh) { @@ -286,37 +162,12 @@ namespace cms { assert(b < nbins()); b += histOff(nh); assert(b < totbins()); - auto w = atomicDecrement(off[b]); + auto w = Base::atomicDecrement(this->off[b]); assert(w > 0); - bins[w - 1] = j; - } - - __host__ __device__ __forceinline__ void finalize(Counter *ws = nullptr) { - assert(off[totbins() - 1] == 0); - blockPrefixScan(off, totbins(), ws); - assert(off[totbins() - 1] == off[totbins() - 2]); + this->content[w - 1] = j; } - - constexpr auto size() const { return uint32_t(off[totbins() - 1]); } - constexpr auto size(uint32_t b) const { return off[b + 1] - off[b]; } - - constexpr index_type const *begin() const { return bins; } - constexpr index_type const *end() const { return begin() + size(); } - - constexpr index_type const *begin(uint32_t b) const { return bins + off[b]; } - constexpr index_type const *end(uint32_t b) const { return bins + off[b + 1]; } - - Counter off[totbins()]; - int32_t psws; // prefix-scan working space - index_type bins[capacity()]; }; - template - using OneToManyAssoc = HistoContainer; - } // namespace cuda } // namespace cms diff --git a/HeterogeneousCore/CUDAUtilities/interface/OneToManyAssoc.h b/HeterogeneousCore/CUDAUtilities/interface/OneToManyAssoc.h new file mode 100644 index 0000000000000..01f48bca94f4b --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/interface/OneToManyAssoc.h @@ -0,0 +1,282 @@ +#ifndef HeterogeneousCore_CUDAUtilities_interface_OneToManyAssoc_h +#define HeterogeneousCore_CUDAUtilities_interface_OneToManyAssoc_h + +#include +#ifndef __CUDA_ARCH__ +#include +#endif // __CUDA_ARCH__ +#include +#include +#include + +#include "HeterogeneousCore/CUDAUtilities/interface/AtomicPairCounter.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cuda_assert.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cudastdAlgorithm.h" +#include "HeterogeneousCore/CUDAUtilities/interface/prefixScan.h" +#include "HeterogeneousCore/CUDAUtilities/interface/FlexiStorage.h" + +namespace cms { + namespace cuda { + + template + struct OneToManyAssocView { + using Counter = typename Assoc::Counter; + using index_type = typename Assoc::index_type; + + Assoc *assoc = nullptr; + Counter *offStorage = nullptr; + index_type *contentStorage = nullptr; + int32_t offSize = -1; + int32_t contentSize = -1; + }; + + // this MUST BE DONE in a single block (or in two kernels!) + template + __global__ void zeroAndInit(OneToManyAssocView view) { + auto h = view.assoc; + assert(1 == gridDim.x); + assert(0 == blockIdx.x); + + int first = threadIdx.x; + + if (0 == first) { + h->psws = 0; + h->initStorage(view); + } + __syncthreads(); + for (int i = first, nt = h->totOnes(); i < nt; i += blockDim.x) { + h->off[i] = 0; + } + } + + template + inline __attribute__((always_inline)) void launchZero(Assoc *h, + cudaStream_t stream +#ifndef __CUDACC__ + = cudaStreamDefault +#endif + ) { + typename Assoc::View view = {h, nullptr, nullptr, -1, -1}; + launchZero(view, stream); + } + template + inline __attribute__((always_inline)) void launchZero(OneToManyAssocView view, + cudaStream_t stream +#ifndef __CUDACC__ + = cudaStreamDefault +#endif + ) { + + if constexpr (Assoc::ctCapacity() < 0) { + assert(view.contentStorage); + assert(view.contentSize > 0); + } + if constexpr (Assoc::ctNOnes() < 0) { + assert(view.offStorage); + assert(view.offSize > 0); + } +#ifdef __CUDACC__ + auto nthreads = 1024; + auto nblocks = 1; // MUST BE ONE as memory is initialize in thread 0 (alternative is two kernels); + zeroAndInit<<>>(view); + cudaCheck(cudaGetLastError()); +#else + auto h = view.assoc; + assert(h); + h->initStorage(view); + h->zero(); + h->psws = 0; +#endif + } + + template + inline __attribute__((always_inline)) void launchFinalize(Assoc *h, + cudaStream_t stream +#ifndef __CUDACC__ + = cudaStreamDefault +#endif + ) { + typename Assoc::View view = {h, nullptr, nullptr, -1, -1}; + launchFinalize(view, stream); + } + + template + inline __attribute__((always_inline)) void launchFinalize(OneToManyAssocView view, + cudaStream_t stream +#ifndef __CUDACC__ + = cudaStreamDefault +#endif + ) { + auto h = view.assoc; + assert(h); +#ifdef __CUDACC__ + using Counter = typename Assoc::Counter; + Counter *poff = (Counter *)((char *)(h) + offsetof(Assoc, off)); + auto nOnes = Assoc::ctNOnes(); + if constexpr (Assoc::ctNOnes() < 0) { + assert(view.offStorage); + assert(view.offSize > 0); + nOnes = view.offSize; + poff = view.offStorage; + } + assert(nOnes > 0); + int32_t *ppsws = (int32_t *)((char *)(h) + offsetof(Assoc, psws)); + auto nthreads = 1024; + auto nblocks = (nOnes + nthreads - 1) / nthreads; + multiBlockPrefixScan<<>>(poff, poff, nOnes, ppsws); + cudaCheck(cudaGetLastError()); +#else + h->finalize(); +#endif + } + + template + __global__ void finalizeBulk(AtomicPairCounter const *apc, Assoc *__restrict__ assoc) { + assoc->bulkFinalizeFill(*apc); + } + + template + class OneToManyAssoc { + public: + using View = OneToManyAssocView>; + using Counter = uint32_t; + + using CountersOnly = OneToManyAssoc; + + using index_type = I; + + static constexpr uint32_t ilog2(uint32_t v) { + constexpr uint32_t b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; + constexpr uint32_t s[] = {1, 2, 4, 8, 16}; + + uint32_t r = 0; // result of log2(v) will go here + for (auto i = 4; i >= 0; i--) + if (v & b[i]) { + v >>= s[i]; + r |= s[i]; + } + return r; + } + + static constexpr int32_t ctNOnes() { return ONES; } + constexpr auto totOnes() const { return off.capacity(); } + constexpr auto nOnes() const { return totOnes() - 1; } + static constexpr int32_t ctCapacity() { return SIZE; } + constexpr auto capacity() const { return content.capacity(); } + + __host__ __device__ void initStorage(View view) { + assert(view.assoc == this); + if constexpr (ctCapacity() < 0) { + assert(view.contentStorage); + assert(view.contentSize > 0); + content.init(view.contentStorage, view.contentSize); + } + if constexpr (ctNOnes() < 0) { + assert(view.offStorage); + assert(view.offSize > 0); + off.init(view.offStorage, view.offSize); + } + } + + __host__ __device__ void zero() { + for (int32_t i = 0; i < totOnes(); ++i) { + off[i] = 0; + } + } + + __host__ __device__ __forceinline__ void add(CountersOnly const &co) { + for (int32_t i = 0; i < totOnes(); ++i) { +#ifdef __CUDA_ARCH__ + atomicAdd(off.data() + i, co.off[i]); +#else + auto &a = (std::atomic &)(off[i]); + a += co.off[i]; +#endif + } + } + + static __host__ __device__ __forceinline__ uint32_t atomicIncrement(Counter &x) { +#ifdef __CUDA_ARCH__ + return atomicAdd(&x, 1); +#else + auto &a = (std::atomic &)(x); + return a++; +#endif + } + + static __host__ __device__ __forceinline__ uint32_t atomicDecrement(Counter &x) { +#ifdef __CUDA_ARCH__ + return atomicSub(&x, 1); +#else + auto &a = (std::atomic &)(x); + return a--; +#endif + } + + __host__ __device__ __forceinline__ void count(int32_t b) { + assert(b < nOnes()); + atomicIncrement(off[b]); + } + + __host__ __device__ __forceinline__ void fill(int32_t b, index_type j) { + assert(b < nOnes()); + auto w = atomicDecrement(off[b]); + assert(w > 0); + content[w - 1] = j; + } + + __host__ __device__ __forceinline__ int32_t bulkFill(AtomicPairCounter &apc, index_type const *v, uint32_t n) { + auto c = apc.add(n); + if (int(c.m) >= nOnes()) + return -int32_t(c.m); + off[c.m] = c.n; + for (uint32_t j = 0; j < n; ++j) + content[c.n + j] = v[j]; + return c.m; + } + + __host__ __device__ __forceinline__ void bulkFinalize(AtomicPairCounter const &apc) { + off[apc.get().m] = apc.get().n; + } + + __host__ __device__ __forceinline__ void bulkFinalizeFill(AtomicPairCounter const &apc) { + int m = apc.get().m; + auto n = apc.get().n; + if (m >= nOnes()) { // overflow! + off[nOnes()] = uint32_t(off[nOnes() - 1]); + return; + } + auto first = m + blockDim.x * blockIdx.x + threadIdx.x; + for (int i = first; i < totOnes(); i += gridDim.x * blockDim.x) { + off[i] = n; + } + } + + __host__ __device__ __forceinline__ void finalize(Counter *ws = nullptr) { + assert(off[totOnes() - 1] == 0); + blockPrefixScan(off.data(), totOnes(), ws); + assert(off[totOnes() - 1] == off[totOnes() - 2]); + } + + constexpr auto size() const { return uint32_t(off[totOnes() - 1]); } + constexpr auto size(uint32_t b) const { return off[b + 1] - off[b]; } + + constexpr index_type const *begin() const { return content.data(); } + constexpr index_type const *end() const { return begin() + size(); } + + constexpr index_type const *begin(uint32_t b) const { return content.data() + off[b]; } + constexpr index_type const *end(uint32_t b) const { return content.data() + off[b + 1]; } + + FlexiStorage off; + int32_t psws; // prefix-scan working space + FlexiStorage content; + }; + + } // namespace cuda +} // namespace cms + +#endif // HeterogeneousCore_CUDAUtilities_interface_HistoContainer_h diff --git a/HeterogeneousCore/CUDAUtilities/test/BuildFile.xml b/HeterogeneousCore/CUDAUtilities/test/BuildFile.xml index c663d4f824a77..53d41efcf4236 100644 --- a/HeterogeneousCore/CUDAUtilities/test/BuildFile.xml +++ b/HeterogeneousCore/CUDAUtilities/test/BuildFile.xml @@ -40,6 +40,10 @@ + + + + @@ -48,6 +52,14 @@ + + + + + + + + @@ -76,6 +88,19 @@ + + + + + + + + + + + + + @@ -104,4 +129,4 @@ - \ No newline at end of file + diff --git a/HeterogeneousCore/CUDAUtilities/test/FlexiStorage_t.cpp b/HeterogeneousCore/CUDAUtilities/test/FlexiStorage_t.cpp new file mode 100644 index 0000000000000..d16c4e44cc97d --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/test/FlexiStorage_t.cpp @@ -0,0 +1,34 @@ +#include "HeterogeneousCore/CUDAUtilities/interface/FlexiStorage.h" + +#include + +using namespace cms::cuda; + +int main() { + FlexiStorage a; + + assert(a.capacity() == 1024); + + FlexiStorage v; + + v.init(a.data(), 20); + + assert(v.capacity() == 20); + + assert(v.data() == a.data()); + + a[4] = 42; + + assert(42 == a[4]); + assert(42 == v[4]); + + auto const& ac = a; + auto const& vc = v; + + assert(42 == ac[4]); + assert(42 == vc[4]); + + assert(ac.data() == vc.data()); + + return 0; +}; diff --git a/HeterogeneousCore/CUDAUtilities/test/HistoContainerRT_t.cu b/HeterogeneousCore/CUDAUtilities/test/HistoContainerRT_t.cu new file mode 100644 index 0000000000000..b49498990fcbe --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/test/HistoContainerRT_t.cu @@ -0,0 +1,165 @@ +#include +#include +#include +#include +#include + +#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" +#include "HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h" +#include "HeterogeneousCore/CUDAUtilities/interface/requireDevices.h" + +using namespace cms::cuda; + +template +void go() { + std::mt19937 eng; + std::uniform_int_distribution rgen(std::numeric_limits::min(), std::numeric_limits::max()); + + constexpr int N = 12000; + T v[N]; + auto v_d = make_device_unique(N, nullptr); + + cudaCheck(cudaMemcpy(v_d.get(), v, N * sizeof(T), cudaMemcpyHostToDevice)); + + constexpr uint32_t nParts = 10; + constexpr uint32_t partSize = N / nParts; + uint32_t offsets[nParts + 1]; + + using Hist = HistoContainer; + std::cout << "HistoContainer " << (int)(offsetof(Hist, off)) << ' ' << Hist::nbins() << ' ' << Hist::totbins() << ' ' + << Hist::ctCapacity() << ' ' << offsetof(Hist, content) - offsetof(Hist, off) << ' ' + << (std::numeric_limits::max() - std::numeric_limits::min()) / Hist::nbins() << std::endl; + + Hist h; + uint32_t mem[N]; + auto h_d = make_device_unique(1, nullptr); + auto h_s = make_device_unique(N, nullptr); + // auto h_s = make_device_unique(N, nullptr); + + auto off_d = make_device_unique(nParts + 1, nullptr); + + for (int it = 0; it < 5; ++it) { + offsets[0] = 0; + for (uint32_t j = 1; j < nParts + 1; ++j) { + offsets[j] = offsets[j - 1] + partSize - 3 * j; + assert(offsets[j] <= N); + } + + if (it == 1) { // special cases... + offsets[0] = 0; + offsets[1] = 0; + offsets[2] = 19; + offsets[3] = 32 + offsets[2]; + offsets[4] = 123 + offsets[3]; + offsets[5] = 256 + offsets[4]; + offsets[6] = 311 + offsets[5]; + offsets[7] = 2111 + offsets[6]; + offsets[8] = 256 * 11 + offsets[7]; + offsets[9] = 44 + offsets[8]; + offsets[10] = 3297 + offsets[9]; + assert(offsets[10] <= N); + } + + cudaCheck(cudaMemcpy(off_d.get(), offsets, 4 * (nParts + 1), cudaMemcpyHostToDevice)); + + for (long long j = 0; j < N; j++) + v[j] = rgen(eng); + + if (it == 2) { // big bin + for (long long j = 1000; j < 2000; j++) + v[j] = sizeof(T) == 1 ? 22 : 3456; + } + + cudaCheck(cudaMemcpy(v_d.get(), v, N * sizeof(T), cudaMemcpyHostToDevice)); + + fillManyFromVector(h_d.get(), nParts, v_d.get(), off_d.get(), offsets[10], 256, h_s.get(), 0); + cudaCheck(cudaMemcpy(&h, h_d.get(), sizeof(Hist), cudaMemcpyDeviceToHost)); + assert(h.capacity() == offsets[10]); + // get content + cudaCheck(cudaMemcpy(mem, h_s.get(), N * sizeof(uint32_t), cudaMemcpyDeviceToHost)); + typename Hist::View view = {&h, nullptr, mem, -1, N}; + // plug correct content + h.initStorage(view); + assert(0 == h.off[0]); + assert(offsets[10] == h.size()); + + auto verify = [&](uint32_t i, uint32_t k, uint32_t t1, uint32_t t2) { + assert(t1 < N); + assert(t2 < N); + if (T(v[t1] - v[t2]) <= 0) + std::cout << "for " << i << ':' << v[k] << " failed " << v[t1] << ' ' << v[t2] << std::endl; + }; + + auto incr = [](auto& k) { return k = (k + 1) % Hist::nbins(); }; + + // make sure it spans 3 bins... + auto window = T(1300); + + for (uint32_t j = 0; j < nParts; ++j) { + auto off = Hist::histOff(j); + for (uint32_t i = 0; i < Hist::nbins(); ++i) { + auto ii = i + off; + if (0 == h.size(ii)) + continue; + auto k = *h.begin(ii); + if (j % 2) + k = *(h.begin(ii) + (h.end(ii) - h.begin(ii)) / 2); + auto bk = h.bin(v[k]); + assert(bk == i); + assert(k < offsets[j + 1]); + auto kl = h.bin(v[k] - window); + auto kh = h.bin(v[k] + window); + assert(kl != i); + assert(kh != i); + // std::cout << kl << ' ' << kh << std::endl; + + auto me = v[k]; + auto tot = 0; + auto nm = 0; + bool l = true; + auto khh = kh; + incr(khh); + for (auto kk = kl; kk != khh; incr(kk)) { + if (kk != kl && kk != kh) + nm += h.size(kk + off); + for (auto p = h.begin(kk + off); p < h.end(kk + off); ++p) { + if (std::min(std::abs(T(v[*p] - me)), std::abs(T(me - v[*p]))) > window) { + } else { + ++tot; + } + } + if (kk == i) { + l = false; + continue; + } + if (l) + for (auto p = h.begin(kk + off); p < h.end(kk + off); ++p) + verify(i, k, k, (*p)); + else + for (auto p = h.begin(kk + off); p < h.end(kk + off); ++p) + verify(i, k, (*p), k); + } + if (!(tot >= nm)) { + std::cout << "too bad " << j << ' ' << i << ' ' << int(me) << '/' << (int)T(me - window) << '/' + << (int)T(me + window) << ": " << kl << '/' << kh << ' ' << khh << ' ' << tot << '/' << nm + << std::endl; + } + if (l) + std::cout << "what? " << j << ' ' << i << ' ' << int(me) << '/' << (int)T(me - window) << '/' + << (int)T(me + window) << ": " << kl << '/' << kh << ' ' << khh << ' ' << tot << '/' << nm + << std::endl; + assert(!l); + } + } + } +} + +int main() { + cms::cudatest::requireDevices(); + + go(); + go(); + + return 0; +} diff --git a/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cpp b/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cpp index 577e9bbb69b57..2109e5a0d5b38 100644 --- a/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cpp +++ b/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cpp @@ -25,51 +25,73 @@ void go() { constexpr int N = 12000; T v[N]; + using HistR = HistoContainer; using Hist = HistoContainer; using Hist4 = HistoContainer; + std::cout << "HistoContainerR " << HistR::nbits() << ' ' << HistR::nbins() << ' ' << HistR::totbins() << ' ' + << HistR::ctNOnes() << ' ' << HistR::ctCapacity() << ' ' << (rmax - rmin) / HistR::nbins() << std::endl; + std::cout << "bins " << int(Hist::bin(0)) << ' ' << int(Hist::bin(rmin)) << ' ' << int(Hist::bin(rmax)) << std::endl; + std::cout << "HistoContainer " << Hist::nbits() << ' ' << Hist::nbins() << ' ' << Hist::totbins() << ' ' - << Hist::capacity() << ' ' << (rmax - rmin) / Hist::nbins() << std::endl; + << Hist::ctCapacity() << ' ' << (rmax - rmin) / Hist::nbins() << std::endl; std::cout << "bins " << int(Hist::bin(0)) << ' ' << int(Hist::bin(rmin)) << ' ' << int(Hist::bin(rmax)) << std::endl; std::cout << "HistoContainer4 " << Hist4::nbits() << ' ' << Hist4::nbins() << ' ' << Hist4::totbins() << ' ' - << Hist4::capacity() << ' ' << (rmax - rmin) / Hist::nbins() << std::endl; + << Hist4::ctCapacity() << ' ' << (rmax - rmin) / Hist::nbins() << std::endl; for (auto nh = 0; nh < 4; ++nh) std::cout << "bins " << int(Hist4::bin(0)) + Hist4::histOff(nh) << ' ' << int(Hist::bin(rmin)) + Hist4::histOff(nh) << ' ' << int(Hist::bin(rmax)) + Hist4::histOff(nh) << std::endl; + uint32_t mem[N]; + HistR hr; + typename HistR::View view{&hr, nullptr, mem, -1, N}; + hr.initStorage(view); + std::cout << "HistoContainerR " << hr.capacity() << std::endl; + assert(hr.capacity() == N); Hist h; Hist4 h4; + assert(h.capacity() == N); + assert(h4.capacity() == N); + for (int it = 0; it < 5; ++it) { for (long long j = 0; j < N; j++) v[j] = rgen(eng); if (it == 2) for (long long j = N / 2; j < N / 2 + N / 4; j++) v[j] = 4; + hr.zero(); h.zero(); h4.zero(); + assert(hr.size() == 0); assert(h.size() == 0); assert(h4.size() == 0); for (long long j = 0; j < N; j++) { + hr.count(v[j]); h.count(v[j]); if (j < 2000) h4.count(v[j], 2); else h4.count(v[j], j % 4); } + assert(hr.size() == 0); assert(h.size() == 0); assert(h4.size() == 0); + hr.finalize(); h.finalize(); h4.finalize(); assert(h.size() == N); assert(h4.size() == N); for (long long j = 0; j < N; j++) { + hr.fill(v[j], j); h.fill(v[j], j); if (j < 2000) h4.fill(v[j], j, 2); else h4.fill(v[j], j, j % 4); } + assert(hr.off[0] == 0); assert(h.off[0] == 0); assert(h4.off[0] == 0); + assert(hr.size() == N); assert(h.size() == N); assert(h4.size() == N); @@ -80,6 +102,11 @@ void go() { std::cout << "for " << i << ':' << v[k] << " failed " << v[t1] << ' ' << v[t2] << std::endl; }; + for (uint32_t i = 0; i < Hist::nbins(); ++i) { + assert(h.size(i) == hr.size(i)); + assert(*h.begin(i) == *hr.begin(i)); + } + for (uint32_t i = 0; i < Hist::nbins(); ++i) { if (0 == h.size(i)) continue; diff --git a/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cu b/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cu index 69974aeef0267..75f9cc0e626f5 100644 --- a/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cu +++ b/HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cu @@ -28,9 +28,11 @@ void go() { using Hist = HistoContainer; std::cout << "HistoContainer " << (int)(offsetof(Hist, off)) << ' ' << Hist::nbins() << ' ' << Hist::totbins() << ' ' - << Hist::capacity() << ' ' << offsetof(Hist, bins) - offsetof(Hist, off) << ' ' + << Hist::ctCapacity() << ' ' << offsetof(Hist, content) - offsetof(Hist, off) << ' ' << (std::numeric_limits::max() - std::numeric_limits::min()) / Hist::nbins() << std::endl; + assert(Hist::totbins() == Hist::ctNOnes()); + Hist h; auto h_d = make_device_unique(1, nullptr); @@ -55,6 +57,7 @@ void go() { offsets[8] = 256 * 11 + offsets[7]; offsets[9] = 44 + offsets[8]; offsets[10] = 3297 + offsets[9]; + assert(offsets[10] <= N); } cudaCheck(cudaMemcpy(off_d.get(), offsets, 4 * (nParts + 1), cudaMemcpyHostToDevice)); @@ -69,7 +72,7 @@ void go() { cudaCheck(cudaMemcpy(v_d.get(), v, N * sizeof(T), cudaMemcpyHostToDevice)); - fillManyFromVector(h_d.get(), nParts, v_d.get(), off_d.get(), offsets[10], 256, 0); + fillManyFromVector(h_d.get(), nParts, v_d.get(), off_d.get(), offsets[10], 256, nullptr, 0); cudaCheck(cudaMemcpy(&h, h_d.get(), sizeof(Hist), cudaMemcpyDeviceToHost)); assert(0 == h.off[0]); assert(offsets[10] == h.size()); diff --git a/HeterogeneousCore/CUDAUtilities/test/OneHistoContainer_t.cu b/HeterogeneousCore/CUDAUtilities/test/OneHistoContainer_t.cu index f08c768b43fa5..f2d74c8e7ce98 100644 --- a/HeterogeneousCore/CUDAUtilities/test/OneHistoContainer_t.cu +++ b/HeterogeneousCore/CUDAUtilities/test/OneHistoContainer_t.cu @@ -112,7 +112,7 @@ void go() { assert(v_d.get()); using Hist = HistoContainer; - std::cout << "HistoContainer " << Hist::nbits() << ' ' << Hist::nbins() << ' ' << Hist::capacity() << ' ' + std::cout << "HistoContainer " << Hist::nbits() << ' ' << Hist::nbins() << ' ' << Hist::ctCapacity() << ' ' << (rmax - rmin) / Hist::nbins() << std::endl; std::cout << "bins " << int(Hist::bin(0)) << ' ' << int(Hist::bin(rmin)) << ' ' << int(Hist::bin(rmax)) << std::endl; diff --git a/HeterogeneousCore/CUDAUtilities/test/OneToManyAssoc_t.h b/HeterogeneousCore/CUDAUtilities/test/OneToManyAssoc_t.h index 36ab026ce1eb6..8ba9158cb69b7 100644 --- a/HeterogeneousCore/CUDAUtilities/test/OneToManyAssoc_t.h +++ b/HeterogeneousCore/CUDAUtilities/test/OneToManyAssoc_t.h @@ -13,16 +13,23 @@ #include "HeterogeneousCore/CUDAUtilities/interface/currentDevice.h" #endif -#include "HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h" +#include "HeterogeneousCore/CUDAUtilities/interface/OneToManyAssoc.h" using cms::cuda::AtomicPairCounter; constexpr uint32_t MaxElem = 64000; constexpr uint32_t MaxTk = 8000; constexpr uint32_t MaxAssocs = 4 * MaxTk; +#ifdef RUNTIME_SIZE +using Assoc = cms::cuda::OneToManyAssoc; +using SmallAssoc = cms::cuda::OneToManyAssoc; +using Multiplicity = cms::cuda::OneToManyAssoc; +#else using Assoc = cms::cuda::OneToManyAssoc; using SmallAssoc = cms::cuda::OneToManyAssoc; using Multiplicity = cms::cuda::OneToManyAssoc; +#endif + using TK = std::array; __global__ void countMultiLocal(TK const* __restrict__ tk, Multiplicity* __restrict__ assoc, int32_t n) { @@ -32,7 +39,7 @@ __global__ void countMultiLocal(TK const* __restrict__ tk, Multiplicity* __restr if (threadIdx.x == 0) local.zero(); __syncthreads(); - local.countDirect(2 + i % 4); + local.count(2 + i % 4); __syncthreads(); if (threadIdx.x == 0) assoc->add(local); @@ -42,12 +49,12 @@ __global__ void countMultiLocal(TK const* __restrict__ tk, Multiplicity* __restr __global__ void countMulti(TK const* __restrict__ tk, Multiplicity* __restrict__ assoc, int32_t n) { int first = blockDim.x * blockIdx.x + threadIdx.x; for (int i = first; i < n; i += gridDim.x * blockDim.x) - assoc->countDirect(2 + i % 4); + assoc->count(2 + i % 4); } __global__ void verifyMulti(Multiplicity* __restrict__ m1, Multiplicity* __restrict__ m2) { auto first = blockDim.x * blockIdx.x + threadIdx.x; - for (auto i = first; i < Multiplicity::totbins(); i += gridDim.x * blockDim.x) + for (int i = first; i < m1->totOnes(); i += gridDim.x * blockDim.x) assert(m1->off[i] == m2->off[i]); } @@ -60,7 +67,7 @@ __global__ void count(TK const* __restrict__ tk, Assoc* __restrict__ assoc, int3 if (k >= n) return; if (tk[k][j] < MaxElem) - assoc->countDirect(tk[k][j]); + assoc->count(tk[k][j]); } } @@ -73,11 +80,11 @@ __global__ void fill(TK const* __restrict__ tk, Assoc* __restrict__ assoc, int32 if (k >= n) return; if (tk[k][j] < MaxElem) - assoc->fillDirect(tk[k][j], k); + assoc->fill(tk[k][j], k); } } -__global__ void verify(Assoc* __restrict__ assoc) { assert(assoc->size() < Assoc::capacity()); } +__global__ void verify(Assoc* __restrict__ assoc) { assert(int(assoc->size()) < assoc->capacity()); } template __global__ void fillBulk(AtomicPairCounter* apc, TK const* __restrict__ tk, Assoc* __restrict__ assoc, int32_t n) { @@ -90,9 +97,55 @@ __global__ void fillBulk(AtomicPairCounter* apc, TK const* __restrict__ tk, Asso template __global__ void verifyBulk(Assoc const* __restrict__ assoc, AtomicPairCounter const* apc) { - if (apc->get().m >= Assoc::nbins()) - printf("Overflow %d %d\n", apc->get().m, Assoc::nbins()); - assert(assoc->size() < Assoc::capacity()); + if (int(apc->get().m) >= assoc->nOnes()) + printf("Overflow %d %d\n", apc->get().m, assoc->nOnes()); + assert(int(assoc->size()) < assoc->capacity()); +} + +template +__global__ void verifyFill(Assoc const* __restrict__ la, int n) { + printf("assoc size %d\n", la->size()); + int imax = 0; + long long ave = 0; + int z = 0; + for (int i = 0; i < n; ++i) { + auto x = la->size(i); + if (x == 0) { + z++; + continue; + } + ave += x; + imax = std::max(imax, int(x)); + } + assert(0 == la->size(n)); + printf("found with %d elements %f %d %d\n", n, double(ave) / n, imax, z); +} + +template +__global__ void verifyFinal(Assoc const* __restrict__ la, int N) { + printf("assoc size %d\n", la->size()); + + int imax = 0; + long long ave = 0; + for (int i = 0; i < N; ++i) { + auto x = la->size(i); + if (!(x == 4 || x == 3)) + printf("%d %d\n", i, x); + assert(x == 4 || x == 3); + ave += x; + imax = std::max(imax, int(x)); + } + assert(0 == la->size(N)); + printf("found with ave occupancy %f %d\n", double(ave) / N, imax); +} + +template +auto make_unique(std::size_t size) { +#ifdef __CUDACC__ + return cms::cuda::make_device_unique(size, 0); +#else + return std::make_unique(size); +#endif } int main() { @@ -118,9 +171,9 @@ int main() { assert(gridDim.z == 1); #endif - std::cout << "OneToManyAssoc " << sizeof(Assoc) << ' ' << Assoc::nbins() << ' ' << Assoc::capacity() << std::endl; - std::cout << "OneToManyAssoc (small) " << sizeof(SmallAssoc) << ' ' << SmallAssoc::nbins() << ' ' - << SmallAssoc::capacity() << std::endl; + std::cout << "OneToManyAssoc " << sizeof(Assoc) << ' ' << Assoc::ctNOnes() << ' ' << Assoc::ctCapacity() << std::endl; + std::cout << "OneToManyAssoc (small) " << sizeof(SmallAssoc) << ' ' << SmallAssoc::ctNOnes() << ' ' + << SmallAssoc::ctCapacity() << std::endl; std::mt19937 eng; @@ -164,19 +217,36 @@ int main() { } std::cout << "filled with " << n << " elements " << double(ave) / n << ' ' << imax << ' ' << nz << std::endl; + auto a_d = make_unique(1); + auto sa_d = make_unique(1); #ifdef __CUDACC__ auto v_d = cms::cuda::make_device_unique[]>(N, nullptr); assert(v_d.get()); - auto a_d = cms::cuda::make_device_unique(1, nullptr); - auto sa_d = cms::cuda::make_device_unique(1, nullptr); cudaCheck(cudaMemcpy(v_d.get(), tr.data(), N * sizeof(std::array), cudaMemcpyHostToDevice)); #else - auto a_d = std::make_unique(); - auto sa_d = std::make_unique(); auto v_d = tr.data(); #endif - launchZero(a_d.get(), 0); + Assoc::Counter* a_st = nullptr; + int a_n = MaxElem; + + Assoc::index_type* a_st2 = nullptr; + SmallAssoc::index_type* sa_st2 = nullptr; + int a_n2 = MaxAssocs; + +// storage +#ifdef RUNTIME_SIZE + auto a_st_d = make_unique(a_n); + auto a_st2_d = make_unique(a_n2); + auto sa_st2_d = make_unique(a_n2); + a_st = a_st_d.get(); + a_st2 = a_st2_d.get(); + sa_st2 = sa_st2_d.get(); +#endif + Assoc::View aView = {a_d.get(), a_st, a_st2, a_n, a_n2}; + launchZero(aView, 0); + SmallAssoc::View saView = {sa_d.get(), nullptr, sa_st2, -1, a_n2}; + launchZero(saView, 0); #ifdef __CUDACC__ auto nThreads = 256; @@ -184,41 +254,21 @@ int main() { count<<>>(v_d.get(), a_d.get(), N); - launchFinalize(a_d.get(), 0); + launchFinalize(aView, 0); verify<<<1, 1>>>(a_d.get()); fill<<>>(v_d.get(), a_d.get(), N); + verifyFill<<<1, 1>>>(a_d.get(), n); + #else count(v_d, a_d.get(), N); - launchFinalize(a_d.get()); + launchFinalize(aView); verify(a_d.get()); fill(v_d, a_d.get(), N); -#endif + verifyFill(a_d.get(), n); - Assoc la; - -#ifdef __CUDACC__ - cudaCheck(cudaMemcpy(&la, a_d.get(), sizeof(Assoc), cudaMemcpyDeviceToHost)); -#else - memcpy(&la, a_d.get(), sizeof(Assoc)); // not required, easier #endif - std::cout << la.size() << std::endl; - imax = 0; - ave = 0; - z = 0; - for (auto i = 0U; i < n; ++i) { - auto x = la.size(i); - if (x == 0) { - z++; - continue; - } - ave += x; - imax = std::max(imax, int(x)); - } - assert(0 == la.size(n)); - std::cout << "found with " << n << " elements " << double(ave) / n << ' ' << imax << ' ' << z << std::endl; - - // now the inverse map (actually this is the direct....) + // now the inverse map (actually this is the ....) AtomicPairCounter* dc_d; AtomicPairCounter dc(0); @@ -230,8 +280,8 @@ int main() { finalizeBulk<<>>(dc_d, a_d.get()); verifyBulk<<<1, 1>>>(a_d.get(), dc_d); - cudaCheck(cudaMemcpy(&la, a_d.get(), sizeof(Assoc), cudaMemcpyDeviceToHost)); cudaCheck(cudaMemcpy(&dc, dc_d, sizeof(AtomicPairCounter), cudaMemcpyDeviceToHost)); + verifyFinal<<<1, 1>>>(a_d.get(), N); cudaCheck(cudaMemset(dc_d, 0, sizeof(AtomicPairCounter))); fillBulk<<>>(dc_d, v_d.get(), sa_d.get(), N); @@ -243,7 +293,8 @@ int main() { fillBulk(dc_d, v_d, a_d.get(), N); finalizeBulk(dc_d, a_d.get()); verifyBulk(a_d.get(), dc_d); - memcpy(&la, a_d.get(), sizeof(Assoc)); + + verifyFinal(a_d.get(), N); AtomicPairCounter sdc(0); fillBulk(&sdc, v_d, sa_d.get(), N); @@ -254,40 +305,35 @@ int main() { std::cout << "final counter value " << dc.get().n << ' ' << dc.get().m << std::endl; - std::cout << la.size() << std::endl; - imax = 0; - ave = 0; - for (auto i = 0U; i < N; ++i) { - auto x = la.size(i); - if (!(x == 4 || x == 3)) - std::cout << i << ' ' << x << std::endl; - assert(x == 4 || x == 3); - ave += x; - imax = std::max(imax, int(x)); - } - assert(0 == la.size(N)); - std::cout << "found with ave occupancy " << double(ave) / N << ' ' << imax << std::endl; - // here verify use of block local counters -#ifdef __CUDACC__ - auto m1_d = cms::cuda::make_device_unique(1, nullptr); - auto m2_d = cms::cuda::make_device_unique(1, nullptr); -#else - auto m1_d = std::make_unique(); - auto m2_d = std::make_unique(); + auto m1_d = make_unique(1); + auto m2_d = make_unique(1); + + Multiplicity::index_type* m1_st = nullptr; + Multiplicity::index_type* m2_st = nullptr; + int m_n = 0; + +#ifdef RUNTIME_SIZE + m_n = MaxTk; + auto m1_st_d = make_unique(m_n); + auto m2_st_d = make_unique(m_n); + m1_st = m1_st_d.get(); + m2_st = m1_st_d.get(); #endif - launchZero(m1_d.get(), 0); - launchZero(m2_d.get(), 0); + Multiplicity::View view1 = {m1_d.get(), nullptr, m1_st, -1, m_n}; + Multiplicity::View view2 = {m2_d.get(), nullptr, m2_st, -1, m_n}; + launchZero(view1, 0); + launchZero(view2, 0); #ifdef __CUDACC__ nBlocks = (4 * N + nThreads - 1) / nThreads; countMulti<<>>(v_d.get(), m1_d.get(), N); countMultiLocal<<>>(v_d.get(), m2_d.get(), N); - verifyMulti<<<1, Multiplicity::totbins()>>>(m1_d.get(), m2_d.get()); + verifyMulti<<<1, Multiplicity::ctNOnes()>>>(m1_d.get(), m2_d.get()); - launchFinalize(m1_d.get(), 0); - launchFinalize(m2_d.get(), 0); - verifyMulti<<<1, Multiplicity::totbins()>>>(m1_d.get(), m2_d.get()); + launchFinalize(view1, 0); + launchFinalize(view2, 0); + verifyMulti<<<1, Multiplicity::ctNOnes()>>>(m1_d.get(), m2_d.get()); cudaCheck(cudaGetLastError()); cudaCheck(cudaDeviceSynchronize()); @@ -296,8 +342,8 @@ int main() { countMultiLocal(v_d, m2_d.get(), N); verifyMulti(m1_d.get(), m2_d.get()); - launchFinalize(m1_d.get()); - launchFinalize(m2_d.get()); + launchFinalize(view1, 0); + launchFinalize(view2, 0); verifyMulti(m1_d.get(), m2_d.get()); #endif return 0; diff --git a/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc b/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc index ea55ab190aa90..685185d8b5155 100644 --- a/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc +++ b/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc @@ -109,7 +109,9 @@ void FlatRandomPtAndDxyGunProducer::produce(Event& e, const EventSetup& es) { break; } - HepMC::GenVertex* Vtx1 = new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz)); + float time = sqrt(vx * vx + vy * vy + vz * vz); + + HepMC::GenVertex* Vtx1 = new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz, time)); int PartID = fPartIDs[ip]; const HepPDT::ParticleData* PData = fPDGTable->particle(HepPDT::ParticleID(abs(PartID))); @@ -124,7 +126,7 @@ void FlatRandomPtAndDxyGunProducer::produce(Event& e, const EventSetup& es) { fEvt->add_vertex(Vtx1); if (fAddAntiParticle) { - HepMC::GenVertex* Vtx2 = new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz)); + HepMC::GenVertex* Vtx2 = new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz, time)); HepMC::FourVector ap(-px, -py, -pz, energy); int APartID = -PartID; if (PartID == 22 || PartID == 23) { diff --git a/JetMETCorrections/Type1MET/python/cleanJetFromEEnoise_cfi.py b/JetMETCorrections/Type1MET/python/cleanJetFromEEnoise_cfi.py index c8b912d623c9a..131072b0295bc 100644 --- a/JetMETCorrections/Type1MET/python/cleanJetFromEEnoise_cfi.py +++ b/JetMETCorrections/Type1MET/python/cleanJetFromEEnoise_cfi.py @@ -26,9 +26,10 @@ ) ) -pfcandidateForUnclusteredUnc = cms.EDProducer("CandPtrProjector", - src = cms.InputTag("packedPFCandidates"), - veto = cms.InputTag("pfcandidateClustered"), +import CommonTools.CandAlgos.candPtrProjector_cfi as _mod +pfcandidateForUnclusteredUnc = _mod.candPtrProjector.clone( + src = "packedPFCandidates", + veto = "pfcandidateClustered", ) diff --git a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc index 48010e6643421..8f557085df83f 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc @@ -1,18 +1,18 @@ -#include -#include -#include -#include -#include -#include +#include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverLUT.h" +#include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverMiniLUT.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTFConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include +#include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -138,21 +138,21 @@ lclphidat CSCSectorReceiverLUT::calcLocalPhi(const lclphiadd& theadd) const { lclphidat data; constexpr int maxPhiL = 1 << CSCBitWidths::kLocalPhiDataBitWidth; - double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS); + double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS_RUN1); double patternOffset; patternOffset = CSCPatternBank::getLegacyPosition((theadd.pattern_type << 3) + theadd.clct_pattern); // The phiL value stored is for the center of the half-/di-strip. - if (theadd.strip < 2 * CSCConstants::MAX_NUM_STRIPS) + if (theadd.strip < 2 * CSCConstants::MAX_NUM_STRIPS_RUN1) if (theadd.pattern_type == 1 || isTMB07) // if halfstrip (Note: no distrips in TMB 2007 patterns) data.phi_local = static_cast((0.5 + theadd.strip + patternOffset) * binPhiL); else // if distrip data.phi_local = static_cast((2 + theadd.strip + 4. * patternOffset) * binPhiL); else { throw cms::Exception("CSCSectorReceiverLUT") << "+++ Value of strip, " << theadd.strip << ", exceeds max allowed, " - << 2 * CSCConstants::MAX_NUM_STRIPS - 1 << " +++\n"; + << 2 * CSCConstants::MAX_NUM_STRIPS_RUN1 - 1 << " +++\n"; } if (data.phi_local >= maxPhiL) { @@ -257,7 +257,7 @@ gblphidat CSCSectorReceiverLUT::calcGlobalPhiME(const gblphiadd& address) const // We will use these to convert the local phi into radians. constexpr unsigned int maxPhiL = 1 << CSCBitWidths::kLocalPhiDataBitWidth; - const double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS); + const double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS_RUN1); if (cscid < CSCTriggerNumbering::minTriggerCscId()) { edm::LogWarning("CSCSectorReceiverLUT|getGlobalPhiValue") @@ -304,9 +304,9 @@ gblphidat CSCSectorReceiverLUT::calcGlobalPhiME(const gblphiadd& address) const // 1023. When we did the conversion in fillLocalPhiTable(), we did // not know for which chamber we do it (and, therefore, how many strips // it has), and always used the maximum possible number of strips - // per chamber, MAX_NUM_STRIPS=80. Now, since we know the chamber id + // per chamber, MAX_NUM_STRIPS_RUN1=80. Now, since we know the chamber id // and how many strips the chamber has, we can re-adjust the scale. - //const double scale = static_cast(CSCConstants::MAX_NUM_STRIPS)/nStrips; + //const double scale = static_cast(CSCConstants::MAX_NUM_STRIPS_RUN1)/nStrips; int strip = 0, halfstrip = 0; @@ -608,15 +608,15 @@ double CSCSectorReceiverLUT::getGlobalEtaValue(const unsigned& thecscid, result = thechamber->layer(CSCConstants::KEY_ALCT_LAYER)->centerOfWireGroup(wire_group).eta(); } else { const unsigned nStrips = layerGeom->numberOfStrips(); - const unsigned nStripsPerBin = CSCConstants::MAX_NUM_STRIPS / numBins; + const unsigned nStripsPerBin = CSCConstants::MAX_NUM_STRIPS_RUN1 / numBins; /** * Calculate Eta correction */ // Check that no strips will be left out. - if (nStrips % numBins != 0 || CSCConstants::MAX_NUM_STRIPS % numBins != 0) + if (nStrips % numBins != 0 || CSCConstants::MAX_NUM_STRIPS_RUN1 % numBins != 0) edm::LogWarning("CSCSectorReceiverLUT") - << "getGlobalEtaValue warning: number of strips " << nStrips << " (" << CSCConstants::MAX_NUM_STRIPS + << "getGlobalEtaValue warning: number of strips " << nStrips << " (" << CSCConstants::MAX_NUM_STRIPS_RUN1 << ") is not divisible by numBins " << numBins << " Station " << _station << " sector " << _sector << " subsector " << _subsector << " cscid " << cscid << "\n"; diff --git a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc index d62ad2a736810..90a57e402b15d 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc @@ -1,19 +1,19 @@ -#include -#include -#include -#include +#include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverMiniLUT.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTFConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" -#include +#include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include -#include lclphidat CSCSectorReceiverMiniLUT::calcLocalPhiMini(unsigned theadd, const bool gangedME1a) { // This method is ripped from CSCSectorReceverLUT.cc with minor changes @@ -24,7 +24,7 @@ lclphidat CSCSectorReceiverMiniLUT::calcLocalPhiMini(unsigned theadd, const bool unsigned short int pattern = ((theadd >> 8) & 0xf); unsigned short int strip = (theadd & 0xff); - if (strip < 2 * (CSCConstants::MAX_NUM_STRIPS * 7 / 5) && + if (strip < 2 * (CSCConstants::MAX_NUM_STRIPS_RUN1 * 7 / 5) && pattern < CSCConstants:: NUM_CLCT_PATTERNS) { // MDG, DA and RW, for ME1 we have 7CFEBs and not just 5, so the num_strips can go up to 16 * 7 but only for ME1 @@ -33,7 +33,7 @@ lclphidat CSCSectorReceiverMiniLUT::calcLocalPhiMini(unsigned theadd, const bool //DA and MDG, rescale range of local phi so ME1/1b fits in 0-511 } else edm::LogWarning("CSCSectorReceiverMiniLUT") << "+++ Value of strip, " << strip << ", exceeds max allowed, " - << 2 * CSCConstants::MAX_NUM_STRIPS - 1 << " +++\n"; + << 2 * CSCConstants::MAX_NUM_STRIPS_RUN1 - 1 << " +++\n"; if (data.phi_local >= maxPhiL) edm::LogWarning("CSCSectorReceiverMiniLUT") @@ -72,7 +72,7 @@ global_eta_data CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(unsigned short end int eta_temp = 999, eta_min = 999, eta_max = 999; - if ((tcscid > 0) && (tcscid <= 12) && (WG < CSCConstants::MAX_NUM_WIRES)) { + if ((tcscid > 0) && (tcscid <= 12) && (WG < CSCConstants::MAX_NUM_WIREGROUPS)) { unsigned short int cscid = (tcscid > 9) ? tcscid - 9 : tcscid; if (station == 1) { unsigned short int lclPhip = 0; @@ -113,7 +113,7 @@ global_eta_data CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(unsigned short end } else { edm::LogWarning("CSCSectorReceiverMiniLUT") << "+++ Value of cscid, " << tcscid << ", is out of bounds, [1, 9] -- or --" - << " Value of wire group, " << WG << ", exceeds max allowed, " << CSCConstants::MAX_NUM_WIRES << " +++\n"; + << " Value of wire group, " << WG << ", exceeds max allowed, " << CSCConstants::MAX_NUM_WIREGROUPS << " +++\n"; } // protect from negative numbers. If the value of eta_temp is <0, set global eta to the minimum value @@ -158,7 +158,7 @@ global_phi_data CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(unsigned short end // 12/11/09 // GP et DA: how to identify the strip number and isolate and shift the localPhi value - const double binPhiL = static_cast(maxPhiL) / (2 * CSCConstants::MAX_NUM_STRIPS); + const double binPhiL = static_cast(maxPhiL) / (2 * CSCConstants::MAX_NUM_STRIPS_RUN1); int strip = static_cast(lclPhi / binPhiL); if (station == 1 && (cscid <= 3) && diff --git a/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc b/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc index 705fef2f8e431..4304a68943cac 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.h" +#include "L1Trigger/DTTrackFinder/src/L1MuDTTFConfig.h" +#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTraco.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "DataFormats/MuonDetId/interface/DTChamberId.h" + +#include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiverLUT.h" CSCTriggerContainer CSCTFDTReceiver::process(const L1MuDTChambPhContainer* dttrig) { dtstubs.clear(); diff --git a/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc b/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc index 95067796693f8..e61135d5856f5 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc @@ -1,6 +1,6 @@ -#include -#include "DataFormats/L1TMuon/interface/CSCConstants.h" -#include +#include "L1Trigger/CSCTrackFinder/interface/CSCTFMuonSorter.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" CSCTFMuonSorter::CSCTFMuonSorter(const edm::ParameterSet& pset) { m_minBX = pset.getParameter("MinBX"); diff --git a/L1Trigger/CSCTrackFinder/src/CSCTFPtLUT.cc b/L1Trigger/CSCTrackFinder/src/CSCTFPtLUT.cc index 17f3bc5956d98..aec66021c3bac 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCTFPtLUT.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCTFPtLUT.cc @@ -229,7 +229,7 @@ ptdat CSCTFPtLUT::calcPt(const ptadd& address) const { double Pi = acos(-1.); float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0; int charge12, charge23; - unsigned type, mode, eta, fr, quality, charge, absPhi12, absPhi23; + unsigned mode, eta, fr, quality, charge, absPhi12, absPhi23; mode = address.track_mode; @@ -381,7 +381,6 @@ ptdat CSCTFPtLUT::calcPt(const ptadd& address) const { } if (bestLH_front_max > best_LH_front) { best_pt_front = ptR_front_max; - best_LH_front = bestLH_front_max; } ptR_front = best_pt_front; @@ -393,7 +392,6 @@ ptdat CSCTFPtLUT::calcPt(const ptadd& address) const { } if (bestLH_rear_max > best_LH_rear) { best_pt_rear = ptR_rear_max; - best_LH_rear = bestLH_rear_max; } ptR_rear = best_pt_rear; } else { @@ -960,7 +958,6 @@ ptdat CSCTFPtLUT::calcPt(const ptadd& address) const { case 9: case 10: case 13: // ME1-ME4 - type = mode - 5; if (charge) absPhi12 = address.delta_phi(); @@ -1054,6 +1051,7 @@ ptdat CSCTFPtLUT::calcPt(const ptadd& address) const { if (pt_method <= 5) { //here we have only pt_methods less or equal to 5 // mode definition you could find at https://twiki.cern.ch/twiki/pub/Main/PtLUTs/mode_codes.xls // it is valid till the end 2010 + unsigned type; // kluge to use 2-stn track in overlap region // see also where this routine is called, and encode LUTaddress, and assignPT diff --git a/L1Trigger/CSCTrackFinder/src/CSCTFPtMethods.cc b/L1Trigger/CSCTrackFinder/src/CSCTFPtMethods.cc index 5e712d2840f16..edeee430f3eab 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCTFPtMethods.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCTFPtMethods.cc @@ -5663,11 +5663,6 @@ float CSCTFPtMethods::Pt2Stn2010(int type, float eta, float dphi, int fr, int me while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood2(par_phi12, par1, par_sig1, v); v[0] = pt + dpt; @@ -5714,8 +5709,7 @@ float CSCTFPtMethods::Pt2Stn2010(int type, float eta, float dphi, int fr, int me if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -5731,11 +5725,6 @@ float CSCTFPtMethods::Pt2Stn2010(int type, float eta, float dphi, int fr, int me while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood2(par_phi12, par1, par_sig1, v); v[0] = pt + dpt; @@ -5782,8 +5771,7 @@ float CSCTFPtMethods::Pt2Stn2010(int type, float eta, float dphi, int fr, int me if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -6263,11 +6251,6 @@ float CSCTFPtMethods::Pt2Stn2011(int type, float eta, float dphi, int fr, int me while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood2_2011(par_phi12, par1, par_sig1, v); v[0] = pt + dpt; @@ -6314,8 +6297,7 @@ float CSCTFPtMethods::Pt2Stn2011(int type, float eta, float dphi, int fr, int me if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -6331,11 +6313,6 @@ float CSCTFPtMethods::Pt2Stn2011(int type, float eta, float dphi, int fr, int me while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood2_2011(par_phi12, par1, par_sig1, v); v[0] = pt + dpt; @@ -6382,8 +6359,7 @@ float CSCTFPtMethods::Pt2Stn2011(int type, float eta, float dphi, int fr, int me if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -6699,11 +6675,6 @@ float CSCTFPtMethods::Pt3Stn2010(int type, float eta, float dphi1, float dphi2, double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); v[0] = pt + dpt; @@ -6750,8 +6721,7 @@ float CSCTFPtMethods::Pt3Stn2010(int type, float eta, float dphi1, float dphi2, if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -6769,11 +6739,6 @@ float CSCTFPtMethods::Pt3Stn2010(int type, float eta, float dphi1, float dphi2, double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); v[0] = pt + dpt; @@ -6821,8 +6786,7 @@ float CSCTFPtMethods::Pt3Stn2010(int type, float eta, float dphi1, float dphi2, if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -7289,12 +7253,6 @@ float CSCTFPtMethods::Pt3Stn2011(int type, float eta, float dphi1, float dphi2, double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; - v[0] = pt; lpt1_1 = Likelihood2011(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); v[0] = pt + dpt; lpt1_2 = Likelihood2011(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); @@ -7322,8 +7280,7 @@ float CSCTFPtMethods::Pt3Stn2011(int type, float eta, float dphi1, float dphi2, if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -7341,11 +7298,6 @@ float CSCTFPtMethods::Pt3Stn2011(int type, float eta, float dphi1, float dphi2, double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1, lpt1_2, lpt2_1, lpt2_2; - v[0] = 0; - lpt1_1 = 1.; - lpt1_2 = 2.; - lpt2_1 = 1.; - lpt2_2 = 2.; v[0] = pt; lpt1_1 = Likelihood2011(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); v[0] = pt + dpt; @@ -7374,8 +7326,7 @@ float CSCTFPtMethods::Pt3Stn2011(int type, float eta, float dphi1, float dphi2, if (pt > 25) { dpt = 0.1; step = 5.; - } - if (pt <= 25) { + } else if (pt <= 25) { dpt = 0.01; step = 0.5; } @@ -7611,8 +7562,6 @@ float CSCTFPtMethods::Pt2Stn2012(int type, float eta, float dphi, int PtbyMLH, f while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood2(par_phi12, par1, par_sig1, v); @@ -7621,22 +7570,17 @@ float CSCTFPtMethods::Pt2Stn2012(int type, float eta, float dphi, int PtbyMLH, f PTsolv = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } - pt = pt - step; } // end while muPlusMaxLH = maxLH; @@ -7652,8 +7596,6 @@ float CSCTFPtMethods::Pt2Stn2012(int type, float eta, float dphi, int PtbyMLH, f while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood2(par_phi12, par1, par_sig1, v); @@ -7677,7 +7619,6 @@ float CSCTFPtMethods::Pt2Stn2012(int type, float eta, float dphi, int PtbyMLH, f if (pt <= 5) { step = 0.5 / 4.0; } - pt = pt - step; } // end while muMinusMaxLH = maxLH; @@ -8026,8 +7967,6 @@ float CSCTFPtMethods::Pt3Stn2012( double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); @@ -8036,22 +7975,17 @@ float CSCTFPtMethods::Pt3Stn2012( PTsolv = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } - pt = pt - step; } // end while muPlusMaxLH = maxLH; @@ -8070,8 +8004,6 @@ float CSCTFPtMethods::Pt3Stn2012( double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); @@ -8080,22 +8012,17 @@ float CSCTFPtMethods::Pt3Stn2012( PTsolvMinus = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } - pt = pt - step; } // end while muMinusMaxLH = maxLH; @@ -8592,8 +8519,6 @@ float CSCTFPtMethods::Pt3Stn2012_DT( double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood2011(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); @@ -8602,22 +8527,17 @@ float CSCTFPtMethods::Pt3Stn2012_DT( PTsolv = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } - pt = pt - step; } // end while muPlusMaxLH = maxLH; @@ -8635,8 +8555,6 @@ float CSCTFPtMethods::Pt3Stn2012_DT( double par_phi12[1] = {dphi1}; double par_phi23[1] = {dphi2}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood2011(par_phi12, par_phi23, par1, par2, par_sig1, par_sig2, par_rho, v); @@ -8645,20 +8563,16 @@ float CSCTFPtMethods::Pt3Stn2012_DT( PTsolvMinus = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } pt = pt - step; } // end while @@ -9144,8 +9058,6 @@ float CSCTFPtMethods::Pt2Stn2012_DT( while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood2_2011(par_phi12, par1, par_sig1, v); @@ -9154,22 +9066,17 @@ float CSCTFPtMethods::Pt2Stn2012_DT( PTsolv = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } - pt = pt - step; } // end while muPlusMaxLH = maxLH; @@ -9185,8 +9092,6 @@ float CSCTFPtMethods::Pt2Stn2012_DT( while (pt > 2.) { double par_phi12[1] = {dphi}; double v[1], lpt1_1; - v[0] = 0; - lpt1_1 = 1.; v[0] = pt; lpt1_1 = Likelihood2_2011(par_phi12, par1, par_sig1, v); @@ -9195,22 +9100,17 @@ float CSCTFPtMethods::Pt2Stn2012_DT( PTsolvMinus = pt; } - if (pt <= 100) { - step = 10.0 / 4.0; - } - if (pt <= 50) { - step = 5.0 / 4.0; - } - if (pt <= 20) { - step = 2.0 / 4.0; - } - if (pt <= 10) { - step = 1.0 / 4.0; - } if (pt <= 5) { step = 0.5 / 4.0; + } else if (pt <= 10) { + step = 1.0 / 4.0; + } else if (pt <= 20) { + step = 2.0 / 4.0; + } else if (pt <= 50) { + step = 5.0 / 4.0; + } else if (pt <= 100) { + step = 10.0 / 4.0; } - pt = pt - step; } // end while muMinusMaxLH = maxLH; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index d127de26c22e4..56bc0e6dfda43 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -37,6 +37,7 @@ #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h" #include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h" @@ -73,7 +74,7 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { // test, being passed the time array, or called by the run() function above. // It gets wire times from an input array and then loops over the keywires. // All found LCT candidates are sorted and the best two are retained. - void run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + void run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); /** Returns vector of ALCTs in the read-out time window, if any. */ std::vector readoutALCTs(int nMaxALCTs = CSCConstants::MAX_ALCTS_READOUT) const; @@ -88,8 +89,12 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { CSCALCTDigi getBestALCT(int bx) const; CSCALCTDigi getSecondALCT(int bx) const; - /* encode special bits for high multiplicity triggers */ - unsigned getHighMultiplictyBits() const { return highMultiplicityBits_; } + /* get special bits for high multiplicity triggers */ + unsigned getInTimeHMT() const { return inTimeHMT_; } + unsigned getOutTimeHMT() const { return outTimeHMT_; } + + /** Returns shower bits */ + CSCShowerDigi readoutShower() const; protected: /** Best LCTs in this chamber, as found by the processor. @@ -105,6 +110,8 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { /** LCTs in this chamber, as found by the processor. */ std::vector > ALCTContainer_; + CSCShowerDigi shower_; + /** Access routines to wire digis. */ bool getDigis(const CSCWireDigiCollection* wiredc); void getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id); @@ -112,19 +119,26 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { int numWireGroups; int MESelection; - int first_bx[CSCConstants::MAX_NUM_WIRES]; - int first_bx_corrected[CSCConstants::MAX_NUM_WIRES]; - int quality[CSCConstants::MAX_NUM_WIRES][3]; + int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]; + int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]; + int quality[CSCConstants::MAX_NUM_WIREGROUPS][3]; std::vector digiV[CSCConstants::NUM_LAYERS]; - unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; + unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]; std::vector lct_list; std::vector thePreTriggerDigis; /* data members for high multiplicity triggers */ - void encodeHighMultiplicityBits(); - unsigned int highMultiplicityBits_; + void encodeHighMultiplicityBits( + const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); + unsigned inTimeHMT_; + unsigned outTimeHMT_; + std::vector thresholds_; + unsigned showerMinInTBin_; + unsigned showerMaxInTBin_; + unsigned showerMinOutTBin_; + unsigned showerMaxOutTBin_; /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig, drift_delay; @@ -182,14 +196,14 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { void clear(const int wire, const int pattern); /* Gets wire times from the wire digis and fills wire[][] vector */ - void readWireDigis(std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + void readWireDigis(std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); /* A pulse array will be used as a bit representation of hit times. For example: if a keywire has a bx_time of 3, then 1 shifted left 3 will be bit pattern 0000000000001000. Bits are then added to signify the duration of a signal (hit_persist, formerly bx_width). So for the pulse with a hit_persist of 6 will look like 0000000111111000. */ - bool pulseExtension(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + bool pulseExtension(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); /* Check that there are nplanes_hit_pretrig or more layers hit in collision or accelerator patterns for a particular key_wire. If so, return @@ -246,7 +260,7 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { void dumpConfigParams() const; /** Dump digis on wire groups. */ - void dumpDigis(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const; + void dumpDigis(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const; void showPatterns(const int key_wire); }; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h index 678ca2eada614..a0c1e0be34f39 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h @@ -6,7 +6,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" @@ -77,6 +77,9 @@ class CSCBaseboard { // CLCT Processor parameters: edm::ParameterSet clctParams_; + // Shower Trigger parameters: + edm::ParameterSet showerParams_; + // chamber name, e.g. ME+1/1/9 std::string theCSCName_; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h index 4479bfd8bec4a..086939466fd20 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h @@ -69,7 +69,7 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { /** Called in test mode and by the run(compdc) function; does the actual LCT finding. */ - void run(const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + void run(const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); /** Returns vector of CLCTs in the read-out time window, if any. */ std::vector readoutCLCTs(int nMaxCLCTs = CSCConstants::MAX_CLCTS_READOUT) const; @@ -91,6 +91,10 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { std::vector preTriggerDigisME1a() const; std::vector preTriggerDigisME1b() const; + /* get special bits for high multiplicity triggers */ + unsigned getInTimeHMT() const { return inTimeHMT_; } + unsigned getOutTimeHMT() const { return outTimeHMT_; } + protected: /** Best LCT in this chamber, as found by the processor. */ CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]; @@ -113,19 +117,21 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { /** Make sure that the parameter values are within the allowed range. */ void checkConfigParameters(); - typedef unsigned int PulseArray[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + typedef unsigned int PulseArray[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; //---------------- Methods common to all firmware versions ------------------ // Single-argument version for TMB07 (halfstrip-only) firmware. // Takes the comparator & time info and stuffs it into halfstrip vector. // Multiple hits on the same strip are allowed. - void readComparatorDigis(std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); - void pulseExtension(const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], - PulseArray pulse); + void readComparatorDigis( + std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); + void pulseExtension( + const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], + PulseArray pulse); //--------------- Functions for post-2007 version of the firmware ----------- virtual std::vector findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */ virtual bool preTrigger(const PulseArray pulse, const int start_bx, int& first_bx); @@ -141,14 +147,17 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { void cleanComparatorContainer(CSCCLCTDigi& lct) const; /* Mark the half-strips around the best half-strip as busy */ - void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + void markBusyKeys(const int best_hstrip, + const int best_patid, + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); //--------------------------- Auxiliary methods ----------------------------- /** Dump CLCT configuration parameters. */ void dumpConfigParams() const; /** Dump half-strip digis */ - void dumpDigis(const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) const; + void dumpDigis( + const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const; // --------Functions for the comparator code algorith for Run-3 ---------// //calculates the id based on location of hits @@ -164,15 +173,15 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { //--------------------------- Member variables ----------------------------- /* best pattern Id for a given half-strip */ - unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; /* number of layers hit on a given half-strip */ - unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; - int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + int first_bx_corrected[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; /* does a given half-strip have a pre-trigger? */ - bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + bool ispretrig[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; // actual LUT used CSCPatternBank::LCTPatterns clct_pattern_ = {}; @@ -202,6 +211,17 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { std::vector thePreTriggerBXs; std::vector thePreTriggerDigis; + /* data members for high multiplicity triggers */ + void encodeHighMultiplicityBits( + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); + unsigned inTimeHMT_; + unsigned outTimeHMT_; + std::vector thresholds_; + unsigned showerMinInTBin_; + unsigned showerMaxInTBin_; + unsigned showerMinOutTBin_; + unsigned showerMaxOutTBin_; + /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode. unsigned int hit_persist, drift_delay; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h index 4da69d2886dcd..04733cbf229a2 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h @@ -37,6 +37,7 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" class CSCMotherboard : public CSCBaseboard { public: @@ -64,6 +65,9 @@ class CSCMotherboard : public CSCBaseboard { /** Returns vector of all found correlated LCTs, if any. */ std::vector getLCTs() const; + /** Returns shower bits */ + CSCShowerDigi readoutShower() const; + /** Clears correlated LCT and passes clear signal on to cathode and anode LCT processors. */ void clear(); @@ -89,6 +93,8 @@ class CSCMotherboard : public CSCBaseboard { /** Container for second correlated LCT. */ CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]; + CSCShowerDigi shower_; + // helper function to return ALCT/CLCT with correct central BX CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi&) const; CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi&) const; @@ -115,8 +121,7 @@ class CSCMotherboard : public CSCBaseboard { bool clct_to_alct; // encode special bits for high-multiplicity triggers - unsigned int highMultiplicityBits_; - bool useHighMultiplicityBits_; + unsigned showerSource_; /** Default values of configuration parameters. */ static const unsigned int def_mpc_block_me1a; @@ -178,6 +183,6 @@ class CSCMotherboard : public CSCBaseboard { void dumpConfigParams() const; /* encode high multiplicity bits for Run-3 exotic triggers */ - void encodeHighMultiplicityBits(unsigned alctBits); + void encodeHighMultiplicityBits(); }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h index de2a2e71cb47e..2b16dfcdcaf09 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h @@ -1,7 +1,7 @@ #ifndef L1Trigger_CSCTriggerPrimitives_CSCPatternBank_h #define L1Trigger_CSCTriggerPrimitives_CSCPatternBank_h -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include // diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h index 85592467f31d0..7c238ae0e1ed7 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h @@ -27,6 +27,7 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -76,6 +77,8 @@ class CSCTriggerPrimitivesBuilder { CSCCLCTPreTriggerCollection& oc_pretrig, CSCCorrelatedLCTDigiCollection& oc_lct, CSCCorrelatedLCTDigiCollection& oc_sorted_lct, + CSCShowerDigiCollection& oc_shower, + CSCShowerDigiCollection& oc_shower_anode, GEMCoPadDigiCollection& oc_gemcopad); /** Max values of trigger labels for all CSCs; used to construct TMB diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h index 11dd9cd8cc623..96637013ee21f 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h @@ -36,7 +36,7 @@ class CSCUpgradeCathodeLCTProcessor : public CSCCathodeLCTProcessor { protected: /* is a given half-strip in a pretrigger dead zone */ - bool busyMap[CSCConstants::NUM_HALF_STRIPS_7CFEBS][CSCConstants::MAX_CLCT_TBINS]; + bool busyMap[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER][CSCConstants::MAX_CLCT_TBINS]; private: /** VK: use of localized dead-time zones */ @@ -51,7 +51,8 @@ class CSCUpgradeCathodeLCTProcessor : public CSCCathodeLCTProcessor { //--------------- Functions for Phase2 studies ---------------- std::vector findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) override; + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) + override; /* Phase2 version, Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */ bool preTrigger(const PulseArray pulse, const int start_bx, int& first_bx) override; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h index 156afb11ec6bc..ca12f1cc83d52 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h @@ -1,7 +1,6 @@ #ifndef L1Trigger_CSCTriggerPrimitives_CSCUpgradeMotherboardLUT_h #define L1Trigger_CSCTriggerPrimitives_CSCUpgradeMotherboardLUT_h -#include "DataFormats/L1TMuon/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h index b9d58e611813e..684adadbb3b2d 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h @@ -10,7 +10,7 @@ */ #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include #include diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h index 02496a3604736..91f9df3ac9d1b 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h @@ -62,7 +62,7 @@ class LCTQualityControl : public CSCBaseboard { unsigned get_csc_max_wire(int station, int ring) const; unsigned get_csc_max_halfstrip(int station, int ring) const; unsigned get_csc_max_quartstrip(int station, int ring) const; - unsigned get_csc_max_eightstrip(int station, int ring) const; + unsigned get_csc_max_eighthstrip(int station, int ring) const; // slope values std::pair get_csc_clct_min_max_slope() const; diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc index bfb1d389b9466..9902d3ea48d6c 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc @@ -3,6 +3,7 @@ #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "Geometry/CSCGeometry/interface/CSCLayer.h" #include "L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" using namespace std; @@ -100,7 +101,7 @@ vector CSCAnodeLCTAnalyzer::lctDigis(const CSCALCTDigi& alct, // check the mask if (CSCPatternBank::alct_pattern_legacy_[alct_pattern][i_layer][i_wire]) { int wire = alct_keywire + CSCPatternBank::alct_keywire_offset_[MESelection][i_wire]; - if (wire >= 0 && wire < CSCConstants::MAX_NUM_WIRES) { + if (wire >= 0 && wire < CSCConstants::MAX_NUM_WIREGROUPS) { // Check if there is a "good" Digi on this wire. if (digiMap.count(wire) > 0) { tempInfo.setId(layerId); // store the layer of this object @@ -299,9 +300,9 @@ int CSCAnodeLCTAnalyzer::nearestWG(const vector& allLayerInfo // Wire groups in ALCTs are counted starting from 0, whereas they // are counted from 1 in MC-related info. nearestWG -= 1; - if (nearestWG < 0 || nearestWG >= CSCConstants::MAX_NUM_WIRES) { + if (nearestWG < 0 || nearestWG >= CSCConstants::MAX_NUM_WIREGROUPS) { edm::LogWarning("L1CSCTPEmulatorWrongInput") - << "+++ Warning: nearest wire group, " << nearestWG << ", is not in [0-" << CSCConstants::MAX_NUM_WIRES + << "+++ Warning: nearest wire group, " << nearestWG << ", is not in [0-" << CSCConstants::MAX_NUM_WIREGROUPS << ") interval +++\n"; } @@ -330,9 +331,9 @@ void CSCAnodeLCTAnalyzer::setGeometry(const CSCGeometry* geom) { geom_ = geom; } double CSCAnodeLCTAnalyzer::getWGEta(const CSCDetId& layerId, const int wiregroup) { // Returns eta position of a given wiregroup. - if (wiregroup < 0 || wiregroup >= CSCConstants::MAX_NUM_WIRES) { + if (wiregroup < 0 || wiregroup >= CSCConstants::MAX_NUM_WIREGROUPS) { edm::LogWarning("L1CSCTPEmulatorWrongInput") << "+++ Warning: wire group, " << wiregroup << ", is not in [0-" - << CSCConstants::MAX_NUM_WIRES << ") interval +++\n"; + << CSCConstants::MAX_NUM_WIREGROUPS << ") interval +++\n"; } const CSCLayer* csclayer = geom_->layer(layerId); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc index 3f5f74e493cd9..7ce39fd9e4feb 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc @@ -53,9 +53,9 @@ vector CSCCathodeLCTAnalyzer::lctDigis(const CSCCLCTDigi& c // The list of ComparatorDigis is stored in a class called CSCLayerInfo which // contains the layerId's of the stored ComparatorDigis as well as the actual // digis themselves. - int hfstripDigis[CSCConstants::NUM_HALF_STRIPS]; - int time[CSCConstants::MAX_NUM_STRIPS], comp[CSCConstants::MAX_NUM_STRIPS]; - int digiNum[CSCConstants::MAX_NUM_STRIPS]; + int hfstripDigis[CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER]; + int time[CSCConstants::MAX_NUM_STRIPS_RUN1], comp[CSCConstants::MAX_NUM_STRIPS_RUN1]; + int digiNum[CSCConstants::MAX_NUM_STRIPS_RUN1]; int digiId = -999; CSCCathodeLayerInfo tempInfo; vector vectInfo; @@ -91,10 +91,10 @@ vector CSCCathodeLCTAnalyzer::lctDigis(const CSCCLCTDigi& c // @ Switch to maps eventually vector digiMap; int digi_num = 0; - for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS; i_hstrip++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER; i_hstrip++) { hfstripDigis[i_hstrip] = -999; } - for (int i_strip = 0; i_strip < CSCConstants::MAX_NUM_STRIPS; i_strip++) { + for (int i_strip = 0; i_strip < CSCConstants::MAX_NUM_STRIPS_RUN1; i_strip++) { time[i_strip] = -999; comp[i_strip] = 0; digiNum[i_strip] = -999; @@ -125,7 +125,7 @@ vector CSCCathodeLCTAnalyzer::lctDigis(const CSCCLCTDigi& c for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_strip = 0; i_strip < CSCConstants::CLCT_PATTERN_WIDTH; i_strip++) { strip = clct_keystrip + key_stagger + CSCPatternBank::clct_pattern_offset_[i_strip]; - if (strip >= 0 && strip < CSCConstants::NUM_HALF_STRIPS) { + if (strip >= 0 && strip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER) { digiId = hfstripDigis[strip]; // halfstripDigis contains the digi numbers // that were carried through the different transformations @@ -153,10 +153,10 @@ int CSCCathodeLCTAnalyzer::preselectDigis(const int clct_bx, const CSCDetId& layerId, const CSCComparatorDigiCollection* compdc, vector& digiMap, - int hfstripDigis[CSCConstants::NUM_HALF_STRIPS], - int time[CSCConstants::MAX_NUM_STRIPS], - int comp[CSCConstants::MAX_NUM_STRIPS], - int digiNum[CSCConstants::MAX_NUM_STRIPS]) { + int hfstripDigis[CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER], + int time[CSCConstants::MAX_NUM_STRIPS_RUN1], + int comp[CSCConstants::MAX_NUM_STRIPS_RUN1], + int digiNum[CSCConstants::MAX_NUM_STRIPS_RUN1]) { // Preselection of Digis: right layer and bx. int digi_num = 0; @@ -366,9 +366,9 @@ int CSCCathodeLCTAnalyzer::nearestHS(const vector& allLayer // Should be in the interval [0-MAX_STRIPS). I see (rarely) cases when // strip = nearestStrip = MAX_STRIPS; do not know how to handle them. int nearestStrip = static_cast(strip); - if (nearestStrip < 0 || nearestStrip >= CSCConstants::MAX_NUM_STRIPS) { + if (nearestStrip < 0 || nearestStrip >= CSCConstants::MAX_NUM_STRIPS_RUN1) { edm::LogWarning("L1CSCTPEmulatorWrongInput") - << "+++ Warning: nearest strip, " << nearestStrip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS + << "+++ Warning: nearest strip, " << nearestStrip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS_RUN1 << ") interval; strip = " << strip << " +++\n"; } // Left/right half of the strip. @@ -400,9 +400,9 @@ void CSCCathodeLCTAnalyzer::setGeometry(const CSCGeometry* geom) { geom_ = geom; double CSCCathodeLCTAnalyzer::getStripPhi(const CSCDetId& layerId, const float strip) { // Returns phi position of a given strip. - if (strip < 0. || strip >= CSCConstants::MAX_NUM_STRIPS) { - edm::LogWarning("L1CSCTPEmulatorWrongInput") - << "+++ Warning: strip, " << strip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS << ") interval +++\n"; + if (strip < 0. || strip >= CSCConstants::MAX_NUM_STRIPS_RUN1) { + edm::LogWarning("L1CSCTPEmulatorWrongInput") << "+++ Warning: strip, " << strip << ", is not in [0-" + << CSCConstants::MAX_NUM_STRIPS_RUN1 << ") interval +++\n"; } const CSCLayer* csclayer = geom_->layer(layerId); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h index 1ef7b0c42ae48..f92f5d1f95642 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h @@ -16,6 +16,7 @@ #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCLayerInfo.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" @@ -66,10 +67,10 @@ class CSCCathodeLCTAnalyzer { const CSCDetId& layerId, const CSCComparatorDigiCollection* compdc, std::vector& digiMap, - int hfstripDigis[CSCConstants::NUM_HALF_STRIPS], - int time[CSCConstants::MAX_NUM_STRIPS], - int comp[CSCConstants::MAX_NUM_STRIPS], - int digiNum[CSCConstants::MAX_NUM_STRIPS]); + int hfstripDigis[CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER], + int time[CSCConstants::MAX_NUM_STRIPS_RUN1], + int comp[CSCConstants::MAX_NUM_STRIPS_RUN1], + int digiNum[CSCConstants::MAX_NUM_STRIPS_RUN1]); /* Find SimHits closest to each ComparatorDigi on CLCT. */ void digiSimHitAssociator(CSCCathodeLayerInfo& info, const edm::PSimHitContainer* allSimHits); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc index 1426a686047e2..475d4a0b81ec4 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc @@ -23,6 +23,8 @@ #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" // Configuration via EventSetup @@ -44,6 +46,7 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS writeOutAllCLCTs_ = conf.getParameter("writeOutAllCLCTs"); writeOutAllALCTs_ = conf.getParameter("writeOutAllALCTs"); savePreTriggers_ = conf.getParameter("savePreTriggers"); + writeOutShowers_ = conf.getParameter("writeOutShowers"); // check whether you need to run the integrated local triggers const edm::ParameterSet commonParam(conf.getParameter("commonParam")); @@ -75,6 +78,10 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS } produces(); produces("MPCSORTED"); + if (writeOutShowers_) { + produces(); + produces("Anode"); + } if (runME11ILT_ or runME21ILT_) produces(); @@ -139,6 +146,8 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup std::unique_ptr oc_pretrig(new CSCCLCTPreTriggerCollection); std::unique_ptr oc_lct(new CSCCorrelatedLCTDigiCollection); std::unique_ptr oc_sorted_lct(new CSCCorrelatedLCTDigiCollection); + std::unique_ptr oc_shower(new CSCShowerDigiCollection); + std::unique_ptr oc_shower_anode(new CSCShowerDigiCollection); std::unique_ptr oc_gemcopad(new GEMCoPadDigiCollection); if (!wireDigis.isValid()) { @@ -169,6 +178,8 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup *oc_pretrig, *oc_lct, *oc_sorted_lct, + *oc_shower, + *oc_shower_anode, *oc_gemcopad); if (!checkBadChambers_) delete temp; @@ -190,6 +201,10 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup ev.put(std::move(oc_pretrig)); ev.put(std::move(oc_lct)); ev.put(std::move(oc_sorted_lct), "MPCSORTED"); + if (writeOutShowers_) { + ev.put(std::move(oc_shower)); + ev.put(std::move(oc_shower_anode), "Anode"); + } // only put GEM copad collections in the event when the // integrated local triggers are running if (runME11ILT_ or runME21ILT_) diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h index e2c8e7b9478c1..688ee515bec24 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h @@ -89,6 +89,9 @@ class CSCTriggerPrimitivesProducer : public edm::one::EDProducer<> { // Write out pre-triggers bool savePreTriggers_; + // write out showrs + bool writeOutShowers_; + // switch to enable the integrated local triggers in ME11 and ME21 bool runME11ILT_; bool runME21ILT_; diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h index 92ce0e485a8e7..6f64274632b87 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h @@ -20,7 +20,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/ESGetToken.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" diff --git a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py index e17e64d1fcc10..23387362c1219 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py +++ b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py @@ -10,6 +10,7 @@ from L1Trigger.CSCTriggerPrimitives.params.tmbParams import tmbPSets from L1Trigger.CSCTriggerPrimitives.params.auxiliaryParams import auxPSets from L1Trigger.CSCTriggerPrimitives.params.cclutParams import cclutParams +from L1Trigger.CSCTriggerPrimitives.params.showerParams import showerPSet cscTriggerPrimitiveDigis = cms.EDProducer( "CSCTriggerPrimitivesProducer", @@ -39,9 +40,11 @@ writeOutAllCLCTs = cms.bool(False), writeOutAllALCTs = cms.bool(False), savePreTriggers = cms.bool(False), + writeOutShowers = cms.bool(False), commonParam = auxPSets.commonParam.clone(), - mpcParam = auxPSets.mpcParamRun1.clone() + mpcParam = auxPSets.mpcParamRun1.clone(), + showerParam = showerPSet.clone() ) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py new file mode 100644 index 0000000000000..8903fbf5c5deb --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py @@ -0,0 +1,73 @@ +import FWCore.ParameterSet.Config as cms + +#Parameterset for the hadronic shower trigger for Run-3 +showerPSet = cms.PSet( + ## what kind of shower triggers the logic? + ## 0: cathode-only (TMB/OTMB) + ## 1: anode-only (from ALCT board) + ## 2: cathode or anode showers + ## loose -> 'loose anode or loose cathode' + ## nominal -> 'nominal anode or nominal cathode' + ## tight -> 'tight anode or tight cathode' + source = cms.uint32(0), + + ## settings for cathode showers (counting CSCComparatorDigi) + cathodeShower = cms.PSet( + ## {loose, nominal, tight} thresholds for hit counters + ## loose ~ 0.75 kHz + ## nominal ~ 0.5 kHz + ## tight ~ 0.25 kHz + showerThresholds = cms.vuint32( + # ME1/1 + 100, 100, 100, + # ME1/2 + 54, 55, 61, + # ME1/3 + 20, 20, 30, + # ME2/1 + 35, 35, 35, + # ME2/2 + 29, 29, 35, + # ME3/1 + 35, 35, 40, + # ME3/2 + 24, 25, 30, + # ME4/1 + 36, 40, 40, + # ME4/2 + 26, 30, 30 + ), + showerMinInTBin = cms.uint32(6), + showerMaxInTBin = cms.uint32(8), + showerMinOutTBin = cms.uint32(2), + showerMaxOutTBin = cms.uint32(5), + ), + ## settings for anode showers (counting CSCWireDigi) + anodeShower = cms.PSet( + ## {loose, nominal, tight} thresholds for hit counters + showerThresholds = cms.vuint32( + # ME1/1 + 104, 105, 107, + # ME1/2 + 92, 100, 102, + # ME1/3 + 32, 33, 48, + # ME2/1 + 133, 134, 136, + # ME2/2 + 83, 84, 86, + # ME3/1 + 130, 131, 133, + # ME3/2 + 74, 80, 87, + # ME4/1 + 127, 128, 130, + # ME4/2 + 88, 89, 94 + ), + showerMinInTBin = cms.uint32(8), + showerMaxInTBin = cms.uint32(10), + showerMinOutTBin = cms.uint32(4), + showerMaxOutTBin = cms.uint32(7), + ) +) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index d07cd0eae7c42..0382ae2ca5d20 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -81,6 +81,13 @@ CSCAnodeLCTProcessor::CSCAnodeLCTProcessor(unsigned endcap, // quality control of stubs qualityControl_ = std::make_unique(endcap, station, sector, subsector, chamber, conf); + + const auto& shower = showerParams_.getParameterSet("anodeShower"); + thresholds_ = shower.getParameter>("showerThresholds"); + showerMinInTBin_ = shower.getParameter("showerMinInTBin"); + showerMaxInTBin_ = shower.getParameter("showerMaxInTBin"); + showerMinOutTBin_ = shower.getParameter("showerMinOutTBin"); + showerMaxOutTBin_ = shower.getParameter("showerMaxOutTBin"); } CSCAnodeLCTProcessor::CSCAnodeLCTProcessor() : CSCBaseboard() { @@ -100,7 +107,7 @@ CSCAnodeLCTProcessor::CSCAnodeLCTProcessor() : CSCBaseboard() { config_dumped = true; } - numWireGroups = CSCConstants::MAX_NUM_WIRES; + numWireGroups = CSCConstants::MAX_NUM_WIREGROUPS; MESelection = (theStation < 3) ? 0 : 1; // Load pattern mask. @@ -195,6 +202,8 @@ void CSCAnodeLCTProcessor::clear() { secondALCT[bx].clear(); } lct_list.clear(); + inTimeHMT_ = 0; + outTimeHMT_ = 0; } void CSCAnodeLCTProcessor::clear(const int wire, const int pattern) { @@ -216,14 +225,14 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* // Get the number of wire groups for the given chamber. Do it only once // per chamber. - if (numWireGroups <= 0 or numWireGroups > CSCConstants::MAX_NUM_WIRES) { + if (numWireGroups <= 0 or numWireGroups > CSCConstants::MAX_NUM_WIREGROUPS) { if (cscChamber_) { numWireGroups = cscChamber_->layer(1)->geometry()->numberOfWireGroups(); - if (numWireGroups > CSCConstants::MAX_NUM_WIRES) { + if (numWireGroups > CSCConstants::MAX_NUM_WIREGROUPS) { edm::LogError("CSCAnodeLCTProcessor|SetupError") << "+++ Number of wire groups, " << numWireGroups << " found in " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")" - << " exceeds max expected, " << CSCConstants::MAX_NUM_WIRES << " +++\n" + << " exceeds max expected, " << CSCConstants::MAX_NUM_WIREGROUPS << " +++\n" << "+++ CSC geometry looks garbled; no emulation possible +++\n"; numWireGroups = -1; } @@ -247,12 +256,12 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* } // Get wire digis in this chamber from wire digi collection. - bool noDigis = getDigis(wiredc); + bool hasDigis = getDigis(wiredc); - if (!noDigis) { - // First get wire times from the wire digis. - std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; - readWireDigis(wire); + if (hasDigis) { + // First get wiregroup times from the wire digis. + std::vector wireGroupTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]; + readWireDigis(wireGroupTimes); // Pass an array of wire times on to another run() doing the LCT search. // If the number of layers containing digis is smaller than that @@ -265,28 +274,30 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* unsigned int layersHit = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_wire = 0; i_wire < numWireGroups; i_wire++) { - if (!wire[i_layer][i_wire].empty()) { + if (!wireGroupTimes[i_layer][i_wire].empty()) { layersHit++; break; } } } if (layersHit >= min_layers) - run(wire); + run(wireGroupTimes); + // Get the high multiplicity bits in this chamber + encodeHighMultiplicityBits(wireGroupTimes); } // Return vector of all found ALCTs. return getALCTs(); } -void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { +void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { bool trigger = false; // Check if there are any in-time hits and do the pulse extension. bool chamber_empty = pulseExtension(wire); // define a new pattern map - // for each key half wire, and for each pattern, store the 2D collection of fired wire digis + // for each key wiregroup, and for each pattern, store the 2D collection of fired wiregroup digis std::map> hits_in_patterns; hits_in_patterns.clear(); @@ -369,7 +380,7 @@ void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAY bool CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc) { // Routine for getting digis and filling digiV vector. - bool noDigis = true; + bool hasDigis = false; // Loop over layers and save wire digis on each one into digiV[layer]. for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { @@ -385,7 +396,7 @@ bool CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc) { } if (!digiV[i_layer].empty()) { - noDigis = false; + hasDigis = true; if (infoV > 1) { LogTrace("CSCAnodeLCTProcessor") << "found " << digiV[i_layer].size() << " wire digi(s) in layer " << i_layer << " of " << theCSCName_ << " (trig. sector " << theSector << " subsector " @@ -397,7 +408,7 @@ bool CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc) { } } - return noDigis; + return hasDigis; } void CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id) { @@ -407,7 +418,8 @@ void CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc, const C } } -void CSCAnodeLCTProcessor::readWireDigis(std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { +void CSCAnodeLCTProcessor::readWireDigis( + std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { // Loop over all 6 layers. for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { // Loop over all digis in the layer and find the wireGroup and bx @@ -464,7 +476,7 @@ void CSCAnodeLCTProcessor::readWireDigis(std::vector wire[CSCConstants::NUM } bool CSCAnodeLCTProcessor::pulseExtension( - const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { + const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { bool chamber_empty = true; int i_wire, i_layer, digi_num; const unsigned int bits_in_pulse = 8 * sizeof(pulse[0][0]); @@ -740,7 +752,7 @@ bool CSCAnodeLCTProcessor::patternDetection( } void CSCAnodeLCTProcessor::ghostCancellationLogic() { - int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2]; + int ghost_cleared[CSCConstants::MAX_NUM_WIREGROUPS][2]; for (int key_wire = 0; key_wire < numWireGroups; key_wire++) { for (int i_pattern = 0; i_pattern < 2; i_pattern++) { @@ -1203,7 +1215,7 @@ void CSCAnodeLCTProcessor::dumpConfigParams() const { // Dump of digis on wire groups. void CSCAnodeLCTProcessor::dumpDigis( - const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const { + const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const { LogDebug("CSCAnodeLCTProcessor") << theCSCName_ << " nWiregroups " << numWireGroups; std::ostringstream strstrm; @@ -1326,6 +1338,9 @@ CSCALCTDigi CSCAnodeLCTProcessor::getBestALCT(int bx) const { return bestALCT[bx CSCALCTDigi CSCAnodeLCTProcessor::getSecondALCT(int bx) const { return secondALCT[bx]; } +/** Returns shower bits */ +CSCShowerDigi CSCAnodeLCTProcessor::readoutShower() const { return shower_; } + //////////////////////////////////////////////////////////////////////// ////////////////////////////Test Routines/////////////////////////////// @@ -1383,3 +1398,45 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire // set the hit container alct.setHits(wireHits); } + +void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( + const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { + inTimeHMT_ = 0; + outTimeHMT_ = 0; + + // functions for in-time and out-of-time + auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; + auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; + + // count the wires in-time and out-time + unsigned hitsInTime = 0; + unsigned hitsOutTime = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIREGROUPS; i_wire++) { + auto times = wires[i_layer][i_wire]; + hitsInTime += std::count_if(times.begin(), times.end(), inTime); + hitsOutTime += std::count_if(times.begin(), times.end(), outTime); + } + } + + // convert station and ring number to index + // index runs from 2 to 10, subtract 2 + unsigned csc_idx = CSCDetId::iChamberType(theStation, theRing) - 2; + + // loose, nominal and tight + std::vector station_thresholds = { + thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; + + // assign the bits + for (unsigned i = 0; i < station_thresholds.size(); i++) { + if (hitsInTime >= station_thresholds[i]) { + inTimeHMT_ = i + 1; + } + if (hitsOutTime >= station_thresholds[i]) { + outTimeHMT_ = i + 1; + } + } + + // create a new object + shower_ = CSCShowerDigi(inTimeHMT_, outTimeHMT_, theTrigChamber); +} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc index 48e95ceb414be..bea2dc5550f38 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc @@ -21,6 +21,8 @@ CSCBaseboard::CSCBaseboard(unsigned endcap, commonParams_ = conf.getParameter("commonParam"); + showerParams_ = conf.getParameterSet("showerParam"); + theCSCName_ = CSCDetId::chamberName(theEndcap, theStation, theRing, theChamber); runPhase2_ = commonParams_.getParameter("runPhase2"); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 63e48a87abeec..aff7b30c657d7 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -98,6 +98,13 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap, } } + const auto& shower = showerParams_.getParameterSet("cathodeShower"); + thresholds_ = shower.getParameter>("showerThresholds"); + showerMinInTBin_ = shower.getParameter("showerMinInTBin"); + showerMaxInTBin_ = shower.getParameter("showerMaxInTBin"); + showerMinOutTBin_ = shower.getParameter("showerMinOutTBin"); + showerMaxOutTBin_ = shower.getParameter("showerMaxOutTBin"); + thePreTriggerDigis.clear(); // quality control of stubs @@ -123,7 +130,7 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor() : CSCBaseboard() { config_dumped = true; } - numStrips_ = CSCConstants::MAX_NUM_STRIPS; + numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN1; // Should be OK for all stations except ME1. for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { if ((i_layer + 1) % 2 == 0) @@ -180,7 +187,7 @@ void CSCCathodeLCTProcessor::checkConfigParameters() { static const unsigned int max_nplanes_hit_pretrig = 1 << 3; static const unsigned int max_nplanes_hit_pattern = 1 << 3; static const unsigned int max_pid_thresh_pretrig = 1 << 4; - static const unsigned int max_min_separation = CSCConstants::NUM_HALF_STRIPS_7CFEBS; + static const unsigned int max_min_separation = CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; static const unsigned int max_tmb_l1a_window_size = 1 << 4; // Checks. @@ -206,6 +213,8 @@ void CSCCathodeLCTProcessor::clear() { bestCLCT[bx].clear(); secondCLCT[bx].clear(); } + inTimeHMT_ = 0; + outTimeHMT_ = 0; } std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiCollection* compdc) { @@ -221,7 +230,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // Get the number of strips and stagger of layers for the given chamber. // Do it only once per chamber. - if (numStrips_ <= 0 or numStrips_ > CSCConstants::MAX_NUM_STRIPS_7CFEBS) { + if (numStrips_ <= 0 or numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) { if (cscChamber_) { numStrips_ = cscChamber_->layer(1)->geometry()->numberOfStrips(); @@ -239,21 +248,21 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl << "+++ CSC geometry looks garbled; no emulation possible +++\n"; } if (!disableME1a_ && theRing == 1 && !gangedME1a_) - numStrips_ = CSCConstants::MAX_NUM_STRIPS_7CFEBS; + numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN2; if (!disableME1a_ && theRing == 1 && gangedME1a_) - numStrips_ = CSCConstants::MAX_NUM_STRIPS; + numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN1; if (disableME1a_ && theRing == 1) - numStrips_ = CSCConstants::MAX_NUM_STRIPS_ME1B; + numStrips_ = CSCConstants::NUM_STRIPS_ME1B; } numHalfStrips_ = 2 * numStrips_ + 1; numCFEBs_ = numStrips_ / CSCConstants::NUM_STRIPS_PER_CFEB; - if (numStrips_ > CSCConstants::MAX_NUM_STRIPS_7CFEBS) { + if (numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) { edm::LogError("CSCCathodeLCTProcessor|SetupError") << "+++ Number of strips, " << numStrips_ << " found in " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")" - << " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_7CFEBS << " +++\n" + << " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_RUN2 << " +++\n" << "+++ CSC geometry looks garbled; no emulation possible +++\n"; numStrips_ = -1; numHalfStrips_ = -1; @@ -301,8 +310,8 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl if (hasDigis) { // Get halfstrip times from comparator digis. - std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; - readComparatorDigis(halfstrip); + std::vector halfStripTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; + readComparatorDigis(halfStripTimes); // Pass arrays of halfstrips on to another run() doing the // LCT search. @@ -312,8 +321,8 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // to the number of planes required to pre-trigger.) unsigned int layersHit = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { - for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { - if (!halfstrip[i_layer][i_hstrip].empty()) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { + if (!halfStripTimes[i_layer][i_hstrip].empty()) { layersHit++; break; } @@ -323,7 +332,10 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // to fire is not null. (Pre-trigger decisions are used for the // strip read-out conditions in DigiToRaw.) if (layersHit >= nplanes_hit_pretrig) - run(halfstrip); + run(halfStripTimes); + + // Get the high multiplicity bits in this chamber + encodeHighMultiplicityBits(halfStripTimes); } // Return vector of CLCTs. @@ -344,7 +356,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl } void CSCCathodeLCTProcessor::run( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { // This version of the run() function can either be called in a standalone // test, being passed the halfstrip times, or called by the // run() function above. It uses the findLCTs() method to find vectors @@ -437,14 +449,14 @@ void CSCCathodeLCTProcessor::getDigis(const CSCComparatorDigiCollection* compdc, for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first; digiIt != rcompd.second; ++digiIt) { const unsigned int origStrip = digiIt->getStrip(); const unsigned int maxStripsME1a = - gangedME1a_ ? CSCConstants::MAX_NUM_STRIPS_ME1A_GANGED : CSCConstants::MAX_NUM_STRIPS_ME1A_UNGANGED; + gangedME1a_ ? CSCConstants::NUM_STRIPS_ME1A_GANGED : CSCConstants::NUM_STRIPS_ME1A_UNGANGED; // this special case can only be reached in MC // in real data, the comparator digis have always ring==1 if (me1a && origStrip <= maxStripsME1a && !disableME1a_) { // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not // been done already. CSCComparatorDigi digi_corr( - origStrip + CSCConstants::MAX_NUM_STRIPS_ME1B, digiIt->getComparator(), digiIt->getTimeBinWord()); + origStrip + CSCConstants::NUM_STRIPS_ME1B, digiIt->getComparator(), digiIt->getTimeBinWord()); digiV[id.layer() - 1].push_back(digi_corr); } else { digiV[id.layer() - 1].push_back(*digiIt); @@ -453,7 +465,7 @@ void CSCCathodeLCTProcessor::getDigis(const CSCComparatorDigiCollection* compdc, } void CSCCathodeLCTProcessor::readComparatorDigis( - std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { int i_digi = 0; // digi counter, for dumps. for (std::vector::iterator pld = digiV[i_layer].begin(); pld != digiV[i_layer].end(); @@ -545,7 +557,7 @@ void CSCCathodeLCTProcessor::readComparatorDigis( // TMB-07 version. std::vector CSCCathodeLCTProcessor::findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { std::vector lctList; if (infoV > 1) @@ -611,7 +623,7 @@ std::vector CSCCathodeLCTProcessor::findLCTs( // could occur already at the next bx. // Quality for sorting. - int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; int best_halfstrip[CSCConstants::MAX_CLCTS_PER_PROCESSOR]; int best_quality[CSCConstants::MAX_CLCTS_PER_PROCESSOR]; @@ -765,7 +777,8 @@ std::vector CSCCathodeLCTProcessor::findLCTs( // Common to all versions. void CSCCathodeLCTProcessor::pulseExtension( - const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], PulseArray pulse) { + const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], + PulseArray pulse) { static const unsigned int bits_in_pulse = 8 * sizeof(pulse[0][0]); // Clear pulse array. This array will be used as a bit representation of @@ -1015,12 +1028,12 @@ bool CSCCathodeLCTProcessor::patternFinding( // TMB-07 version. void CSCCathodeLCTProcessor::markBusyKeys(const int best_hstrip, const int best_patid, - int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { int nspan = min_separation; int pspan = min_separation; for (int hstrip = best_hstrip - nspan; hstrip <= best_hstrip + pspan; hstrip++) { - if (hstrip >= 0 && hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS) { + if (hstrip >= 0 && hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER) { quality[hstrip] = 0; } } @@ -1060,7 +1073,7 @@ void CSCCathodeLCTProcessor::dumpConfigParams() const { // Reasonably nice dump of digis on half-strips. void CSCCathodeLCTProcessor::dumpDigis( - const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) const { + const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const { LogDebug("CSCCathodeLCTProcessor") << theCSCName_ << " strip type: half-strip, numHalfStrips " << numHalfStrips_; std::ostringstream strstrm; @@ -1353,7 +1366,7 @@ void CSCCathodeLCTProcessor::runCCLUT(CSCCLCTDigi& digi) const { strm << "+ Before CCCLUT algorithm: +\n"; strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; strm << " Old CLCT digi " << digi << "\n"; - strm << " 1/4 strip bit " << digi.getQuartStrip() << " 1/8 strip bit " << digi.getEightStrip() << "\n"; + strm << " 1/4 strip bit " << digi.getQuartStrip() << " 1/8 strip bit " << digi.getEighthStrip() << "\n"; strm << " 1/4 strip number " << digi.getKeyStrip(4) << " 1/8 strip number " << digi.getKeyStrip(8) << "\n"; strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; LogDebug("CSCCathodeLCTProcessor") << strm.str(); @@ -1430,7 +1443,7 @@ void CSCCathodeLCTProcessor::runCCLUT(CSCCLCTDigi& digi) const { // store the new 1/2, 1/4 and 1/8 strip positions digi.setStrip(halfstrip - digi.getCFEB() * CSCConstants::NUM_HALF_STRIPS_PER_CFEB); digi.setQuartStrip(std::get<1>(stripoffset)); - digi.setEightStrip(std::get<2>(stripoffset)); + digi.setEighthStrip(std::get<2>(stripoffset)); // store the bending angle value in the pattern data member digi.setSlope(slopeCCValue); @@ -1446,7 +1459,7 @@ void CSCCathodeLCTProcessor::runCCLUT(CSCCLCTDigi& digi) const { strm << "+ CCCLUT algorithm results: +\n"; strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; strm << " New CLCT digi " << digi << "\n"; - strm << " 1/4 strip bit " << digi.getQuartStrip() << " 1/8 strip bit " << digi.getEightStrip() << "\n"; + strm << " 1/4 strip bit " << digi.getQuartStrip() << " 1/8 strip bit " << digi.getEighthStrip() << "\n"; strm << " 1/4 strip number " << digi.getKeyStrip(4) << " 1/8 strip number " << digi.getKeyStrip(8) << "\n"; strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; LogDebug("CSCCathodeLCTProcessor") << strm.str(); @@ -1454,7 +1467,50 @@ void CSCCathodeLCTProcessor::runCCLUT(CSCCLCTDigi& digi) const { } unsigned CSCCathodeLCTProcessor::convertSlopeToRun2Pattern(const unsigned slope) const { - const unsigned slopeList[32] = {10, 10, 8, 8, 8, 8, 6, 6, 6, 6, 4, 4, 4, 2, 2, 2, - 10, 10, 9, 9, 9, 9, 7, 7, 7, 7, 5, 5, 5, 3, 3, 3}; + const unsigned slopeList[32] = {10, 10, 10, 8, 8, 8, 6, 6, 6, 6, 4, 4, 2, 2, 2, 2, + 10, 10, 10, 9, 9, 9, 7, 7, 7, 7, 5, 5, 3, 3, 3, 3}; return slopeList[slope]; } + +void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { + inTimeHMT_ = 0; + outTimeHMT_ = 0; + + // functions for in-time and out-of-time + auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; + auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; + + // count the half-strips in-time and out-time + unsigned hitsInTime = 0; + unsigned hitsOutTime = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { + auto times = halfstrip[i_layer][i_hstrip]; + hitsInTime += std::count_if(times.begin(), times.end(), inTime); + hitsOutTime += std::count_if(times.begin(), times.end(), outTime); + } + } + + // convert station and ring number to index + // index runs from 2 to 10, subtract 2 + unsigned csc_idx = CSCDetId::iChamberType(theStation, theRing) - 2; + + // loose, nominal and tight + std::vector station_thresholds = { + thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; + + // assign the bits + for (unsigned i = 0; i < station_thresholds.size(); i++) { + if (hitsInTime >= station_thresholds[i]) { + inTimeHMT_ = i + 1; + } + if (hitsOutTime >= station_thresholds[i]) { + outTimeHMT_ = i + 1; + } + } + + // no shower object is created here. that is done at a later stage + // in the motherboar, where potentially the trigger decisions from + // anode hit counters and cathode hit counters are combined +} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 8eb194e38e681..3c86aa1bd24cb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -150,7 +150,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct // 4-bit slope value derived with the CCLUT algorithm thisLCT.setSlope(clct.getSlope()); thisLCT.setQuartStrip(clct.getQuartStrip()); - thisLCT.setEightStrip(clct.getEightStrip()); + thisLCT.setEighthStrip(clct.getEighthStrip()); thisLCT.setRun3Pattern(clct.getRun3Pattern()); } } else if (alct.isValid() and clct.isValid() and not gem1.isValid() and gem2.isValid()) { @@ -175,7 +175,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct // 4-bit slope value derived with the CCLUT algorithm thisLCT.setSlope(clct.getSlope()); thisLCT.setQuartStrip(clct.getQuartStrip()); - thisLCT.setEightStrip(clct.getEightStrip()); + thisLCT.setEighthStrip(clct.getEighthStrip()); thisLCT.setRun3Pattern(clct.getRun3Pattern()); } } else if (alct.isValid() and gem2.isValid() and not clct.isValid()) { @@ -249,7 +249,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct // 4-bit slope value derived with the CCLUT algorithm thisLCT.setSlope(clct.getSlope()); thisLCT.setQuartStrip(clct.getQuartStrip()); - thisLCT.setEightStrip(clct.getEightStrip()); + thisLCT.setEighthStrip(clct.getEighthStrip()); thisLCT.setRun3Pattern(clct.getRun3Pattern()); } } @@ -273,9 +273,6 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct // Not used in Run-2. Will not be assigned in Run-3 thisLCT.setSyncErr(0); thisLCT.setCSCID(theTrigChamber); - // in Run-3 we plan to denote the presence of exotic signatures in the chamber - if (useHighMultiplicityBits_) - thisLCT.setHMT(highMultiplicityBits_); // future work: add a section that produces LCTs according // to the new LCT dataformat (not yet defined) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc index 7d5275100c7df..c8c36ab6c43cf 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc @@ -60,8 +60,7 @@ void CSCGEMMotherboardME11::run(const CSCWireDigiCollection* wiredc, CSCGEMMotherboard::clear(); // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); if (gem_g != nullptr) { if (infoV >= 0) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc index 8d2e6d114a38f..bc7b661a68e1d 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc @@ -43,8 +43,7 @@ void CSCGEMMotherboardME21::run(const CSCWireDigiCollection* wiredc, CSCGEMMotherboard::clear(); // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); if (gem_g != nullptr) { if (infoV >= 0) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 305dcf71ea968..df6aa5c8de1a3 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -38,10 +38,6 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, clct_to_alct = tmbParams_.getParameter("clctToAlct"); - // special tmb bits - useHighMultiplicityBits_ = tmbParams_.getParameter("useHighMultiplicityBits"); - highMultiplicityBits_ = 0; - // whether to readout only the earliest two LCTs in readout window readout_earliest_2 = tmbParams_.getParameter("tmbReadoutEarliest2"); @@ -59,6 +55,9 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, // quality control of stubs qualityControl_ = std::make_unique(endcap, station, sector, subsector, chamber, conf); + + // shower-trigger source + showerSource_ = showerParams_.getParameter("source"); } CSCMotherboard::CSCMotherboard() : CSCBaseboard() { @@ -102,6 +101,9 @@ void CSCMotherboard::clear() { firstLCT[bx].clear(); secondLCT[bx].clear(); } + + // reset the shower trigger + shower_.clear(); } // Set configuration parameters obtained via EventSetup mechanism. @@ -150,8 +152,7 @@ void CSCMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCComparato return; // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); // CLCT-centric matching if (clct_to_alct) { @@ -428,6 +429,8 @@ std::vector CSCMotherboard::getLCTs() const { return tmpV; } +CSCShowerDigi CSCMotherboard::readoutShower() const { return shower_; } + void CSCMotherboard::correlateLCTs( const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, const CSCCLCTDigi& sCLCT, int type) { CSCALCTDigi bestALCT = bALCT; @@ -524,14 +527,10 @@ CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs(const CSCALCTDigi& aLCT, // 4-bit slope value derived with the CCLUT algorithm thisLCT.setSlope(cLCT.getSlope()); thisLCT.setQuartStrip(cLCT.getQuartStrip()); - thisLCT.setEightStrip(cLCT.getEightStrip()); + thisLCT.setEighthStrip(cLCT.getEighthStrip()); thisLCT.setRun3Pattern(cLCT.getRun3Pattern()); } - // in Run-3 we plan to denote the presence of exotic signatures in the chamber - if (useHighMultiplicityBits_) - thisLCT.setHMT(highMultiplicityBits_); - // make sure to shift the ALCT BX from 8 to 3 and the CLCT BX from 8 to 7! thisLCT.setALCT(getBXShiftedALCT(aLCT)); thisLCT.setCLCT(getBXShiftedCLCT(cLCT)); @@ -708,11 +707,38 @@ CSCCLCTDigi CSCMotherboard::getBXShiftedCLCT(const CSCCLCTDigi& cLCT) const { return cLCT_shifted; } -void CSCMotherboard::encodeHighMultiplicityBits(unsigned alctBits) { - // encode the high multiplicity bits in the (O)TMB based on - // the high multiplicity bits from the ALCT processor - // draft version: simply rellay the ALCT bits. - // future versions may involve also bits from the CLCT processor - // this depends on memory constraints in the TMB FPGA - highMultiplicityBits_ = alctBits; +void CSCMotherboard::encodeHighMultiplicityBits() { + // get the high multiplicity + // for anode this reflects what is already in the anode CSCShowerDigi object + unsigned cathodeInTime = clctProc->getInTimeHMT(); + unsigned cathodeOutTime = clctProc->getOutTimeHMT(); + unsigned anodeInTime = alctProc->getInTimeHMT(); + unsigned anodeOutTime = alctProc->getOutTimeHMT(); + + // assign the bits + unsigned inTimeHMT_; + unsigned outTimeHMT_; + + // set the value according to source + switch (showerSource_) { + case 0: + inTimeHMT_ = cathodeInTime; + outTimeHMT_ = cathodeOutTime; + break; + case 1: + inTimeHMT_ = anodeInTime; + outTimeHMT_ = anodeOutTime; + break; + case 2: + inTimeHMT_ = (anodeInTime & CSCShowerDigi::kInTimeMask) | (cathodeInTime & CSCShowerDigi::kInTimeMask); + outTimeHMT_ = (anodeOutTime & CSCShowerDigi::kOutTimeMask) | (cathodeOutTime & CSCShowerDigi::kOutTimeMask); + break; + default: + inTimeHMT_ = cathodeInTime; + outTimeHMT_ = cathodeOutTime; + break; + }; + + // create a new object + shower_ = CSCShowerDigi(inTimeHMT_, outTimeHMT_, theTrigChamber); } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc index 63e180b301f1b..53c8c126b0d3b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc @@ -72,8 +72,7 @@ void CSCMotherboardME11::run(const CSCWireDigiCollection* wiredc, const CSCCompa return; // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); int used_alct_mask[20]; int used_clct_mask[20]; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc index bc329f0a5fa15..94ddf47314a3a 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc @@ -1,5 +1,5 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCMuonPortCard.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include CSCMuonPortCard::CSCMuonPortCard() {} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc index d0b6cab1c7417..8eb395d935b35 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc @@ -119,6 +119,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, CSCCLCTPreTriggerCollection& oc_pretrig, CSCCorrelatedLCTDigiCollection& oc_lct, CSCCorrelatedLCTDigiCollection& oc_sorted_lct, + CSCShowerDigiCollection& oc_shower, + CSCShowerDigiCollection& oc_shower_anode, GEMCoPadDigiCollection& oc_gemcopad) { // CSC geometry. for (int endc = min_endcap; endc <= max_endcap; endc++) { @@ -178,6 +180,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& clctV1a = tmb11->clctProc->readoutCLCTsME1a(); const std::vector& pretriggerV1a = tmb11->clctProc->preTriggerDigisME1a(); const std::vector& alctpretriggerV = tmb11->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb11->readoutShower(); + const CSCShowerDigi& anodeShower = tmb11->alctProc->readoutShower(); if (infoV > 1) LogTrace("CSCTriggerPrimitivesBuilder") @@ -198,6 +202,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, " ME1b CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " ME1b CLCT pre-trigger BX"); put(alctpretriggerV, oc_alctpretrigger, detid, " ME1b ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); // ME1/a @@ -246,6 +254,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& pretriggerV1a = tmb11GEM->clctProc->preTriggerDigisME1a(); const std::vector& copads = tmb11GEM->coPadProcessor->readoutCoPads(); const std::vector& alctpretriggerV = tmb11GEM->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb11GEM->readoutShower(); + const CSCShowerDigi& anodeShower = tmb11GEM->alctProc->readoutShower(); // ME1/b if (!(lctV.empty() && alctV.empty() && clctV.empty()) and infoV > 1) { @@ -262,6 +272,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(preTriggerBXs, oc_pretrig, detid, " ME1b CLCT pre-trigger BX"); put(copads, oc_gemcopad, gemId, " GEM coincidence pad"); put(alctpretriggerV, oc_alctpretrigger, detid, " ME1b ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); // ME1/a if (disableME1a_) @@ -303,6 +317,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& pretriggerV = tmb21GEM->clctProc->preTriggerDigis(); const std::vector& copads = tmb21GEM->coPadProcessor->readoutCoPads(); const std::vector& alctpretriggerV = tmb21GEM->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb21GEM->readoutShower(); + const CSCShowerDigi& anodeShower = tmb21GEM->alctProc->readoutShower(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -318,6 +334,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(preTriggerBXs, oc_pretrig, detid, " ME21 CLCT pre-trigger BX"); put(copads, oc_gemcopad, gemId, " GEM coincidence pad"); put(alctpretriggerV, oc_alctpretrigger, detid, " ME21 ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); } // running upgraded ME2/1-ME3/1-ME4/1 TMBs (without GEMs or RPCs) else if (runPhase2_ and ring == 1 and @@ -339,6 +359,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& preTriggerBXs = utmb->clctProc->preTriggerBXs(); const std::vector& pretriggerV = utmb->clctProc->preTriggerDigis(); const std::vector& alctpretriggerV = utmb->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = utmb->readoutShower(); + const CSCShowerDigi& anodeShower = utmb->alctProc->readoutShower(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -353,6 +375,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, " CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " CLCT pre-trigger BX"); put(alctpretriggerV, oc_alctpretrigger, detid, " ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); } // running non-upgraded TMB @@ -371,6 +397,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& preTriggerBXs = tmb->clctProc->preTriggerBXs(); const std::vector& pretriggerV = tmb->clctProc->preTriggerDigis(); const std::vector& alctpretriggerV = tmb->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb->readoutShower(); + const CSCShowerDigi& anodeShower = tmb->alctProc->readoutShower(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -385,6 +413,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, tmb->getCSCName() + " CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, tmb->getCSCName() + " CLCT pre-trigger BX"); put(alctpretriggerV, oc_alctpretrigger, detid, tmb->getCSCName() + " ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); } // non-upgraded TMB } } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc index 29c5c5dc07106..b7f93d4ade2cb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc @@ -27,7 +27,7 @@ CSCUpgradeAnodeLCTProcessor::CSCUpgradeAnodeLCTProcessor() : CSCAnodeLCTProcesso } void CSCUpgradeAnodeLCTProcessor::ghostCancellationLogic() { - int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2]; + int ghost_cleared[CSCConstants::MAX_NUM_WIREGROUPS][2]; for (int key_wire = 0; key_wire < numWireGroups; key_wire++) { for (int i_pattern = 0; i_pattern < 2; i_pattern++) { diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc index c8eb90711f0ab..88c8f9e81775b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc @@ -135,7 +135,7 @@ bool CSCUpgradeCathodeLCTProcessor::preTrigger(const PulseArray pulse, const int // Phase2 version. std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { // run the original algorithm in case we do not use dead time zoning if (runPhase2_ and !use_dead_time_zoning) { return CSCCathodeLCTProcessor::findLCTs(halfstrip); @@ -152,7 +152,7 @@ std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( dumpDigis(halfstrip); // keeps dead-time zones around key halfstrips of triggered CLCTs - for (int i = 0; i < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i++) { + for (int i = 0; i < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i++) { for (int j = 0; j < CSCConstants::MAX_CLCT_TBINS; j++) { busyMap[i][j] = false; } @@ -160,7 +160,7 @@ std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( std::vector lctListBX; - unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; // Fire half-strip one-shots for hit_persist bx's (4 bx's by default). pulseExtension(halfstrip, pulse); @@ -210,30 +210,30 @@ std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( int keystrip_data[CSCConstants::MAX_CLCTS_PER_PROCESSOR][CLCT_NUM_QUANTITIES] = {{0}}; // Quality for sorting. - int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; int best_halfstrip[CSCConstants::MAX_CLCTS_PER_PROCESSOR], best_quality[CSCConstants::MAX_CLCTS_PER_PROCESSOR]; for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) { best_halfstrip[ilct] = -1; best_quality[ilct] = 0; } - bool pretrig_zone[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + bool pretrig_zone[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; // Calculate quality from pattern id and number of hits, and // simultaneously select best-quality LCT. if (hits_in_time) { // first, mark half-strip zones around pretriggers // that happened at the current first_bx - for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++) + for (int hstrip = 0; hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; hstrip++) pretrig_zone[hstrip] = false; - for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++) { + for (int hstrip = 0; hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; hstrip++) { if (ispretrig[hstrip]) { int min_hs = hstrip - pretrig_trig_zone; int max_hs = hstrip + pretrig_trig_zone; if (min_hs < 0) min_hs = 0; - if (max_hs > CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1) - max_hs = CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1; + if (max_hs > CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER - 1) + max_hs = CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER - 1; for (int hs = min_hs; hs <= max_hs; hs++) pretrig_zone[hs] = true; if (infoV > 1) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc index b050da3aadfcb..ef0ef7a6cc0cd 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc @@ -85,8 +85,7 @@ void CSCUpgradeMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCCo return; // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); int used_clct_mask[20]; for (int c = 0; c < 20; ++c) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc index 4dfecf7c0b57c..70c137c7defbb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc @@ -1,4 +1,5 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" CSCMotherboardLUTME11::CSCMotherboardLUTME11() { // Keep in mind that ME1A is considered an extension of ME1B diff --git a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc index 94f8fb82fc4f9..a11025d0dfe13 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc @@ -115,13 +115,13 @@ void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) checkRange(clct.getCompCode(), 0, std::pow(2, 12) - 1, "CSCCLCTDigi with invalid comparator code: ", errors); const unsigned max_quartstrip = get_csc_max_quartstrip(theStation, theRing); - const unsigned max_eightstrip = get_csc_max_eightstrip(theStation, theRing); + const unsigned max_eighthstrip = get_csc_max_eighthstrip(theStation, theRing); // CLCT key quart-strip must be within bounds checkRange(clct.getKeyStrip(4), 0, max_quartstrip - 1, "CSCCLCTDigi with invalid key quart-strip: ", errors); - // CLCT key eight-strip must be within bounds - checkRange(clct.getKeyStrip(8), 0, max_eightstrip - 1, "CSCCLCTDigi with invalid key quart-strip: ", errors); + // CLCT key eighth-strip must be within bounds + checkRange(clct.getKeyStrip(8), 0, max_eighthstrip - 1, "CSCCLCTDigi with invalid key quart-strip: ", errors); } reportErrors(clct, errors); @@ -132,7 +132,7 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct) const { chec void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsigned station, const unsigned ring) const { const unsigned max_strip = get_csc_max_halfstrip(station, ring); const unsigned max_quartstrip = get_csc_max_quartstrip(station, ring); - const unsigned max_eightstrip = get_csc_max_eightstrip(station, ring); + const unsigned max_eighthstrip = get_csc_max_eighthstrip(station, ring); const unsigned max_wire = get_csc_max_wire(station, ring); const auto& [min_pattern, max_pattern] = get_csc_lct_min_max_pattern(); const unsigned max_quality = get_csc_lct_max_quality(); @@ -154,8 +154,8 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign // LCT key quart-strip must be within bounds checkRange(lct.getStrip(4), 0, max_quartstrip - 1, "CSCCorrelatedLCTDigi with invalid key quart-strip: ", errors); - // LCT key eight-strip must be within bounds - checkRange(lct.getStrip(8), 0, max_eightstrip - 1, "CSCCorrelatedLCTDigi with invalid key eight-strip: ", errors); + // LCT key eighth-strip must be within bounds + checkRange(lct.getStrip(8), 0, max_eighthstrip - 1, "CSCCorrelatedLCTDigi with invalid key eighth-strip: ", errors); // LCT key wire-group must be within bounds checkRange(lct.getKeyWG(), 0, max_wire - 1, "CSCCorrelatedLCTDigi with invalid wire-group: ", errors); @@ -306,14 +306,14 @@ unsigned LCTQualityControl::get_csc_max_quartstrip(int station, int ring) const return get_csc_max_halfstrip(station, ring) * 2; } -unsigned LCTQualityControl::get_csc_max_eightstrip(int station, int ring) const { +unsigned LCTQualityControl::get_csc_max_eighthstrip(int station, int ring) const { return get_csc_max_halfstrip(station, ring) * 4; } std::pair LCTQualityControl::get_csc_min_max_cfeb(int station, int ring) const { // 5 CFEBs [0,4] for non-ME1/1 chambers int min_cfeb = 0; - int max_cfeb = CSCConstants::MAX_CFEBS - 1; // 4 + int max_cfeb = CSCConstants::MAX_CFEBS_RUN1 - 1; // 4 // 7 CFEBs [0,6] for ME1/1 chambers if (station == 1 and ring == 1) { max_cfeb = 6; diff --git a/L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp b/L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp index 398b070e422b6..ca0f2c6aefdd1 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp +++ b/L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp @@ -131,7 +131,7 @@ void writeHeaderSlopeLUT(ofstream& file); unsigned firmwareWord(const unsigned quality, const unsigned slope, const unsigned offset); void setDataWord(unsigned& word, const unsigned newWord, const unsigned shift, const unsigned mask); unsigned assignPosition(const float fvalue, const float fmin, const float fmax, const unsigned nbits); -unsigned assignBending(const float fvalue, const float fmin, const float fmax, const unsigned nbits); +unsigned assignBending(const float fvalue); int CCLUTLinearFitWriter(unsigned N_LAYER_REQUIREMENT = 3) { //all the patterns we will fit @@ -340,15 +340,13 @@ int CCLUTLinearFitWriter(unsigned N_LAYER_REQUIREMENT = 3) { // everything is in half-strips const float fmaxOffset = 2; const float fminOffset = -1.75; - const float fmaxSlope = 2.5; - const float fminSlope = 0; // negative bending -> 0 // positive bending -> 1 const bool slope_sign(slope >= 0); const unsigned offset_bin = assignPosition(offset, fminOffset, fmaxOffset, 4); - unsigned slope_bin = assignBending(std::abs(slope), fminSlope, fmaxSlope, 4); + unsigned slope_bin = assignBending(std::abs(slope)); if (slope_sign) slope_bin += 16; const unsigned fwword = firmwareWord(0, slope_bin, offset_bin); @@ -504,7 +502,7 @@ void writeHeaderSlopeLUT(ofstream& file) { } unsigned assignPosition(const float fvalue, const float fmin, const float fmax, const unsigned nbits) { - bool debug; + bool debug = false; unsigned value = 0; const unsigned range = pow(2, nbits); const unsigned minValue = 0; @@ -524,24 +522,23 @@ unsigned assignPosition(const float fvalue, const float fmin, const float fmax, return value; } -unsigned assignBending(const float fvalue, const float fmin, const float fmax, const unsigned nbits) { - bool debug; +unsigned assignBending(const float fvalue) { + bool debug = false; unsigned value = 0; - const unsigned range = pow(2, nbits); - const unsigned minValue = 0; - const unsigned maxValue = range - 1; - const double fdelta = (fmax - fmin) / range; - if (fvalue >= fmax) { - value = maxValue; - } else if (fvalue <= fmin) { - value = minValue; - } else { - value = std::min(unsigned(std::floor((fvalue - fmin) / fdelta)), maxValue); - } - if (debug) - std::cout << "fvalue " << fvalue << " " << fmin << " " << fmax << " " << nbits << " " << value << std::endl; + // as defined in DN-19-059, section 4.8 + float slopes[17] = { + 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; + for (unsigned i = 0; i < 16; i++) { + if (fvalue >= slopes[i] and fvalue < slopes[i + 1]) { + value = i; + } + } + // overflow bin or undefined value + if (fvalue >= slopes[16]) { + value = 15; + } return value; } diff --git a/L1Trigger/L1TMuon/src/GeometryTranslator.cc b/L1Trigger/L1TMuon/src/GeometryTranslator.cc index a2d21348b9cb7..b29597cb23270 100644 --- a/L1Trigger/L1TMuon/src/GeometryTranslator.cc +++ b/L1Trigger/L1TMuon/src/GeometryTranslator.cc @@ -12,7 +12,7 @@ #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h" diff --git a/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc b/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc index 0a30c75123de5..fd44216bf2b05 100644 --- a/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc +++ b/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc @@ -29,7 +29,7 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" //#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/L1TMuon/interface/GeometryTranslator.h" #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h" diff --git a/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc b/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc index 0a5de70d30ecb..e11a7f5ae4e8d 100644 --- a/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc +++ b/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc @@ -19,7 +19,7 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "Geometry/CSCGeometry/interface/CSCChamber.h" diff --git a/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc b/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc index 3bded865e4b43..50fda8c43715f 100644 --- a/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc +++ b/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc @@ -5,11 +5,11 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/Transition.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h" diff --git a/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc b/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc index 6a89510248d50..5f9e25ca6b041 100644 --- a/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc +++ b/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc @@ -12,7 +12,7 @@ #include "L1Trigger/L1TMuonOverlap/interface/OMTFinput.h" #include "L1Trigger/L1TMuonOverlap/interface/OMTFConfiguration.h" #include "L1Trigger/L1TMuonOverlap/interface/AngleConverter.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" /////////////////////////////////////// diff --git a/OnlineDB/EcalCondDB/interface/FEConfigCokeDat.h b/OnlineDB/EcalCondDB/interface/FEConfigCokeDat.h new file mode 100644 index 0000000000000..b9d26f41066e4 --- /dev/null +++ b/OnlineDB/EcalCondDB/interface/FEConfigCokeDat.h @@ -0,0 +1,147 @@ +#ifndef ONLINEDB_ECALCONDDB_FECONFIGCOKEDAT_H +#define ONLINEDB_ECALCONDDB_FECONFIGCOKEDAT_H + +#include +#include + +#include "OnlineDB/EcalCondDB/interface/IDataItem.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" + +class FEConfigCokeDat : public IDataItem { +public: + friend class EcalCondDBInterface; // XXX temp should not need + FEConfigCokeDat(); + ~FEConfigCokeDat() override; + + // User data methods + inline std::string getTable() override { return "FE_CONFIG_COKE_DAT"; } + + inline void setThreshold(int x) { m_thre = x; } + inline int getThreshold() const { return m_thre; } + inline void setSuccEventLimit(int x) { m_succ_ev_lim = x; } + inline int getSuccEventLimit() const { return m_succ_ev_lim; } + inline void setCumulEventLimit(int x) { m_cum_ev_lim = x; } + inline int getCumulEventLimit() const { return m_cum_ev_lim; } + inline void setSuccDetectEnable(int x) { m_succ_det_en = x; } + inline int getSuccDetectEnable() const { return m_succ_det_en; } + inline void setCumDetectEnable(int x) { m_cum_det_en = x; } + inline int getCumDetectEnable() const { return m_cum_det_en; } + inline void setThreshold1(int x) { m_thre1 = x; } + inline int getThreshold1() const { return m_thre1; } + inline void setSucc1EventLimit(int x) { m_succ1_ev_lim = x; } + inline int getSucc1EventLimit() const { return m_succ1_ev_lim; } + inline void setCumul1EventLimit(int x) { m_cum1_ev_lim = x; } + inline int getCumul1EventLimit() const { return m_cum1_ev_lim; } + inline void setCombiMode(int x) { m_combi_mode = x; } + inline int getCombiMode() const { return m_combi_mode; } + inline void setOccMode(int x) { m_occ_mode = x; } + inline int getOccMode() const { return m_occ_mode; } + inline void setCombSuccDetect(int x) { m_comb_succ_det = x; } + inline int getCombSuccDetect() const { return m_comb_succ_det; } + inline void setCombCumulDetect(int x) { m_comb_cumul_det = x; } + inline int getCombCumulDetect() const { return m_comb_cumul_det; } + inline void setOccDetect(int x) { m_occ_det = x; } + inline int getOccDetect() const { return m_occ_det; } + inline void setCumul1Detect(int x) { m_cum1_det = x; } + inline int getCumul1Detect() const { return m_cum1_det; } + inline void setThreshold2(int x) { m_thre2 = x; } + inline int getThreshold2() const { return m_thre2; } + inline void setOccLimit(int x) { m_occ_lim = x; } + inline int getOccLimit() const { return m_occ_lim; } + inline void setThreshold3(int x) { m_thre3 = x; } + inline int getThreshold3() const { return m_thre3; } + inline void setCumul2Limit(int x) { m_cum2_lim = x; } + inline int getCumul2Limit() const { return m_cum2_lim; } + inline void setStopBufW(int x) { m_stop_bufw = x; } + inline int getStopBufW() const { return m_stop_bufw; } + // this simplifies the code + inline void setPar1(int x) { m_thre = x; } + inline int getPar1() const { return m_thre; } + inline void setPar2(int x) { m_succ_ev_lim = x; } + inline int getPar2() const { return m_succ_ev_lim; } + inline void setPar3(int x) { m_cum_ev_lim = x; } + inline int getPar3() const { return m_cum_ev_lim; } + inline void setPar4(int x) { m_succ_det_en = x; } + inline int getPar4() const { return m_succ_det_en; } + inline void setPar5(int x) { m_cum_det_en = x; } + inline int getPar5() const { return m_cum_det_en; } + inline void setPar6(int x) { m_thre1 = x; } + inline int getPar6() const { return m_thre1; } + inline void setPar7(int x) { m_succ1_ev_lim = x; } + inline int getPar7() const { return m_succ1_ev_lim; } + inline void setPar8(int x) { m_cum1_ev_lim = x; } + inline int getPar8() const { return m_cum1_ev_lim; } + inline void setPar9(int x) { m_combi_mode = x; } + inline int getPar9() const { return m_combi_mode; } + inline void setPar10(int x) { m_occ_mode = x; } + inline int getPar10() const { return m_occ_mode; } + inline void setPar11(int x) { m_comb_succ_det = x; } + inline int getPar11() const { return m_comb_succ_det; } + inline void setPar12(int x) { m_comb_cumul_det = x; } + inline int getPar12() const { return m_comb_cumul_det; } + inline void setPar13(int x) { m_occ_det = x; } + inline int getPar13() const { return m_occ_det; } + inline void setPar14(int x) { m_cum1_det = x; } + inline int getPar14() const { return m_cum1_det; } + inline void setPar15(int x) { m_thre2 = x; } + inline int getPar15() const { return m_thre2; } + inline void setPar16(int x) { m_occ_lim = x; } + inline int getPar16() const { return m_occ_lim; } + inline void setPar17(int x) { m_thre3 = x; } + inline int getPar17() const { return m_thre3; } + inline void setPar18(int x) { m_cum2_lim = x; } + inline int getPar18() const { return m_cum2_lim; } + inline void setPar19(int x) { m_stop_bufw = x; } + inline int getPar19() const { return m_stop_bufw; } + + void clear() { + m_thre = 0; + m_succ_ev_lim = 0; + m_cum_ev_lim = 0; + m_succ_det_en = 0; + m_cum_det_en = 0; + m_thre1 = 0; + m_succ1_ev_lim = 0; + m_cum1_ev_lim = 0; + m_combi_mode = 0; + m_occ_mode = 0; + m_comb_succ_det = 0; + m_comb_cumul_det = 0; + m_occ_det = 0; + m_cum1_det = 0; + m_thre2 = 0; + m_occ_lim = 0; + m_thre3 = 0; + m_cum2_lim = 0; + m_stop_bufw = 0; + } + +private: + void prepareWrite() noexcept(false) override; + void writeDB(const EcalLogicID* ecid, const FEConfigCokeDat* item, FEConfigCokeInfo* iconf) noexcept(false); + void writeArrayDB(const std::map* data, FEConfigCokeInfo* iconf) noexcept(false); + void fetchData(std::map* fillMap, FEConfigCokeInfo* iconf) noexcept(false); + // User data + int m_thre; + int m_succ_ev_lim; + int m_cum_ev_lim; + int m_succ_det_en; + int m_cum_det_en; + int m_thre1; + int m_succ1_ev_lim; + int m_cum1_ev_lim; + int m_combi_mode; + int m_occ_mode; + int m_comb_succ_det; + int m_comb_cumul_det; + int m_occ_det; + int m_cum1_det; + int m_thre2; + int m_occ_lim; + int m_thre3; + int m_cum2_lim; + int m_stop_bufw; +}; + +#endif diff --git a/OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h b/OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h new file mode 100644 index 0000000000000..d34ae5051491a --- /dev/null +++ b/OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h @@ -0,0 +1,56 @@ +#ifndef ONLINEDB_ECALCONDDB_FECONFIGCOKEINFO_H +#define ONLINEDB_ECALCONDDB_FECONFIGCOKEINFO_H + +#include +#include + +#include "OnlineDB/EcalCondDB/interface/IODConfig.h" +#include "OnlineDB/EcalCondDB/interface/Tm.h" +#include "OnlineDB/EcalCondDB/interface/DateHandler.h" + +class FEConfigCokeInfo : public IODConfig { +public: + friend class EcalCondDBInterface; + + FEConfigCokeInfo(); + ~FEConfigCokeInfo() override; + + // Methods for user data + inline std::string getTable() override { return "FE_CONFIG_COKE_INFO"; } + + inline void setId(int id) { m_ID = id; } + inline int getId() const { return m_ID; } + // for compatibility + void setID(int id) { setId(id); } + int getID() { return getId(); } + // the tag is already in IODConfig + inline void setVersion(int id) { m_version = id; } + inline int getVersion() const { return m_version; } + + Tm getDBTime() const { return m_db_time; } + void setDBTime(const Tm& x) { m_db_time = x; } + + // Methods from IUniqueDBObject + int fetchID() noexcept(false); + int fetchNextId() noexcept(false); + void setByID(int id) noexcept(false); + void setParameters(const std::map& my_keys_map); + + // operators + inline bool operator==(const FEConfigCokeInfo& r) const { return (m_ID == r.m_ID); } + inline bool operator!=(const FEConfigCokeInfo& r) const { return !(*this == r); } + +private: + // User data for this IOV + int m_ID; + Tm m_db_time; + int m_version; + + void prepareWrite() noexcept(false) override; + void writeDB() noexcept(false); + void clear(); + void fetchData(FEConfigCokeInfo* result) noexcept(false); + void fetchLastData(FEConfigCokeInfo* result) noexcept(false); +}; + +#endif diff --git a/OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h b/OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h index 0f194e9cda08b..a5aa7f9e8cb33 100644 --- a/OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h +++ b/OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h @@ -63,6 +63,18 @@ class FEConfigMainInfo : public IODConfig { void setBstId(int x) { m_bst_id = x; } int getBstId() const { return m_bst_id; } // + void setCokeId(int x) { m_coke_id = x; } + int getCokeId() const { return m_coke_id; } + // + void setWeight2Id(int x) { m_wei2_id = x; } + int getWeight2Id() const { return m_wei2_id; } + // + void setWei2Id(int x) { m_wei2_id = x; } + int getWei2Id() const { return m_wei2_id; } + // + void setOddWeiId(int x) { m_wei2_id = x; } + int getOddWeiId() const { return m_wei2_id; } + // inline void setVersion(int id) { m_version = id; } inline int getVersion() const { return m_version; } @@ -84,6 +96,8 @@ class FEConfigMainInfo : public IODConfig { int m_bst_id; int m_tim_id; int m_spi_id; + int m_coke_id; + int m_wei2_id; int m_version; Tm m_db_time; std::string m_description; diff --git a/OnlineDB/EcalCondDB/interface/FEConfigOddWeightDat.h b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightDat.h new file mode 100644 index 0000000000000..5f1b6e718601b --- /dev/null +++ b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightDat.h @@ -0,0 +1,37 @@ +#ifndef ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTDAT +#define ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTDAT + +#include +#include + +#include "OnlineDB/EcalCondDB/interface/IDataItem.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" + +class FEConfigOddWeightDat : public IDataItem { +public: + friend class EcalCondDBInterface; // XXX temp should not need + FEConfigOddWeightDat(); + ~FEConfigOddWeightDat() override; + + // User data methods + inline std::string getTable() override { return "FE_CONFIG_WEIGHT2_DAT"; } + + inline void setWeightGroupId(int x) { m_group_id = x; } + inline int getWeightGroupId() const { return m_group_id; } + +private: + void prepareWrite() noexcept(false) override; + + void writeDB(const EcalLogicID* ecid, const FEConfigOddWeightDat* item, FEConfigOddWeightInfo* iconf) noexcept(false); + + void writeArrayDB(const std::map* data, + FEConfigOddWeightInfo* iconf) noexcept(false); + + void fetchData(std::map* fillMap, FEConfigOddWeightInfo* iconf) noexcept(false); + + // User data + int m_group_id; +}; + +#endif diff --git a/OnlineDB/EcalCondDB/interface/FEConfigOddWeightGroupDat.h b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightGroupDat.h new file mode 100644 index 0000000000000..ebd4ee3ca2cc1 --- /dev/null +++ b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightGroupDat.h @@ -0,0 +1,59 @@ +#ifndef ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTGROUPDAT_H +#define ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTGROUPDAT_H + +#include +#include + +#include "OnlineDB/EcalCondDB/interface/IDataItem.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" + +class FEConfigOddWeightGroupDat : public IDataItem { +public: + friend class EcalCondDBInterface; // XXX temp should not need + FEConfigOddWeightGroupDat(); + ~FEConfigOddWeightGroupDat() override; + + // User data methods + inline std::string getTable() override { return "FE_WEIGHT2_PER_GROUP_DAT"; } + + inline void setWeightGroupId(int x) { m_group_id = x; } + inline int getWeightGroupId() const { return m_group_id; } + + inline void setWeight0(float x) { m_w0 = x; } + inline float getWeight0() const { return m_w0; } + inline void setWeight1(float x) { m_w1 = x; } + inline float getWeight1() const { return m_w1; } + inline void setWeight2(float x) { m_w2 = x; } + inline float getWeight2() const { return m_w2; } + inline void setWeight3(float x) { m_w3 = x; } + inline float getWeight3() const { return m_w3; } + inline void setWeight4(float x) { m_w4 = x; } + inline float getWeight4() const { return m_w4; } + inline void setWeight5(float x) { m_w5 = x; } + inline float getWeight5() const { return m_w5; } + +private: + void prepareWrite() noexcept(false) override; + + void writeDB(const EcalLogicID* ecid, + const FEConfigOddWeightGroupDat* item, + FEConfigOddWeightInfo* iconf) noexcept(false); + + void writeArrayDB(const std::map* data, + FEConfigOddWeightInfo* iconf) noexcept(false); + + void fetchData(std::map* fillMap, + FEConfigOddWeightInfo* iconf) noexcept(false); + + // User data + int m_group_id; + float m_w0; + float m_w1; + float m_w2; + float m_w3; + float m_w4; + float m_w5; +}; + +#endif diff --git a/OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h new file mode 100644 index 0000000000000..cc93d264ed2eb --- /dev/null +++ b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h @@ -0,0 +1,60 @@ +#ifndef ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTINFO_H +#define ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTINFO_H + +#include +#include + +#include "OnlineDB/EcalCondDB/interface/IODConfig.h" +#include "OnlineDB/EcalCondDB/interface/Tm.h" +#include "OnlineDB/EcalCondDB/interface/DateHandler.h" + +class FEConfigOddWeightInfo : public IODConfig { +public: + friend class EcalCondDBInterface; + + FEConfigOddWeightInfo(); + ~FEConfigOddWeightInfo() override; + + // Methods for user data + inline std::string getTable() override { return "FE_CONFIG_WEIGHT2_INFO"; } + + void setNumberOfGroups(int n) { m_ngr = n; } + int getNumberOfGroups() const { return m_ngr; } + + inline void setId(int id) { m_ID = id; } + inline int getId() const { return m_ID; } + // for compatibility + void setID(int id) { setId(id); } + int getID() { return getId(); } + // the tag is already in IODConfig + inline void setVersion(int id) { m_version = id; } + inline int getVersion() const { return m_version; } + + Tm getDBTime() const { return m_db_time; } + void setDBTime(const Tm& x) { m_db_time = x; } + + // Methods from IUniqueDBObject + int fetchID() noexcept(false); + int fetchNextId() noexcept(false); + void setByID(int id) noexcept(false); + void setParameters(const std::map& my_keys_map); + + // operators + inline bool operator==(const FEConfigOddWeightInfo& r) const { return (m_ID == r.m_ID); } + inline bool operator!=(const FEConfigOddWeightInfo& r) const { return !(*this == r); } + +private: + // User data for this IOV + int m_ngr; + int m_ID; + Tm m_db_time; + int m_version; + + void prepareWrite() noexcept(false) override; + void writeDB() noexcept(false); + void clear(); + void fetchData(FEConfigOddWeightInfo* result) noexcept(false); + void fetchLastData(FEConfigOddWeightInfo* result) noexcept(false); +}; + +#endif diff --git a/OnlineDB/EcalCondDB/interface/FEConfigOddWeightModeDat.h b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightModeDat.h new file mode 100644 index 0000000000000..2f3a5671c8e2d --- /dev/null +++ b/OnlineDB/EcalCondDB/interface/FEConfigOddWeightModeDat.h @@ -0,0 +1,139 @@ +#ifndef ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTMODEDAT_H +#define ONLINEDB_ECALCONDDB_FECONFIGODDWEIGHTMODEDAT_H + +#include +#include + +#include "OnlineDB/EcalCondDB/interface/IDataItem.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" +#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h" + +class FEConfigOddWeightModeDat : public IDataItem { +public: + friend class EcalCondDBInterface; // XXX temp should not need + FEConfigOddWeightModeDat(); + ~FEConfigOddWeightModeDat() override; + + // User data methods + inline std::string getTable() override { return "FE_WEIGHT2_MODE_DAT"; } + + inline void setEnableEBOddFilter(int x) { m_en_EB_flt = x; } + inline float getEnableEBOddFilter() const { return m_en_EB_flt; } + inline void setEnableEEOddFilter(int x) { m_en_EE_flt = x; } + inline float getEnableEEOddFilter() const { return m_en_EE_flt; } + + inline void setEnableEBOddPeakFinder(int x) { m_en_EB_pf = x; } + inline float getEnableEBOddPeakFinder() const { return m_en_EB_pf; } + inline void setEnableEEOddPeakFinder(int x) { m_en_EE_pf = x; } + inline float getEnableEEOddPeakFinder() const { return m_en_EE_pf; } + + inline void setDisableEBEvenPeakFinder(int x) { m_dis_EB_even_pf = x; } + inline float getDisableEBEvenPeakFinder() const { return m_dis_EB_even_pf; } + inline void setDisableEEEvenPeakFinder(int x) { m_dis_EE_even_pf = x; } + inline float getDisableEEEvenPeakFinder() const { return m_dis_EE_even_pf; } + + inline void setFenixEBStripOutput(int x) { m_fe_EB_strout = x; } + inline float getFenixEBStripOutput() const { return m_fe_EB_strout; } + inline void setFenixEEStripOutput(int x) { m_fe_EE_strout = x; } + inline float getFenixEEStripOutput() const { return m_fe_EE_strout; } + + inline void setFenixEBStripInfobit2(int x) { m_fe_EB_strib2 = x; } + inline float getFenixEBStripInfobit2() const { return m_fe_EB_strib2; } + inline void setFenixEEStripInfobit2(int x) { m_fe_EE_strib2 = x; } + inline float getFenixEEStripInfobit2() const { return m_fe_EE_strib2; } + + inline void setFenixEBTcpOutput(int x) { m_fe_EB_tcpout = x; } + inline float getFenixEBTcpOutput() const { return m_fe_EB_tcpout; } + inline void setFenixEBTcpInfoBit1(int x) { m_fe_EB_tcpib1 = x; } + inline float getFenixEBTcpInfobit1() const { return m_fe_EB_tcpib1; } + + inline void setFenixEETcpOutput(int x) { m_fe_EE_tcpout = x; } + inline float getFenixEETcpOutput() const { return m_fe_EE_tcpout; } + inline void setFenixEETcpInfoBit1(int x) { m_fe_EE_tcpib1 = x; } + inline float getFenixEETcpInfobit1() const { return m_fe_EE_tcpib1; } + + // redundant methods for simplification of the code + + inline void setFenixPar1(int x) { m_en_EB_flt = x; } + inline float getFenixPar1() const { return m_en_EB_flt; } + inline void setFenixPar2(int x) { m_en_EE_flt = x; } + inline float getFenixPar2() const { return m_en_EE_flt; } + + inline void setFenixPar3(int x) { m_en_EB_pf = x; } + inline float getFenixPar3() const { return m_en_EB_pf; } + inline void setFenixPar4(int x) { m_en_EE_pf = x; } + inline float getFenixPar4() const { return m_en_EE_pf; } + + inline void setFenixPar5(int x) { m_dis_EB_even_pf = x; } + inline float getFenixPar5() const { return m_dis_EB_even_pf; } + + inline void setFenixPar6(int x) { m_dis_EE_even_pf = x; } + inline float getFenixPar6() const { return m_dis_EE_even_pf; } + + inline void setFenixPar7(int x) { m_fe_EB_strout = x; } + inline float getFenixPar7() const { return m_fe_EB_strout; } + inline void setFenixPar8(int x) { m_fe_EE_strout = x; } + inline float getFenixPar8() const { return m_fe_EE_strout; } + + inline void setFenixPar9(int x) { m_fe_EB_strib2 = x; } + inline float getFenixPar9() const { return m_fe_EB_strib2; } + inline void setFenixPar10(int x) { m_fe_EE_strib2 = x; } + inline float getFenixPar10() const { return m_fe_EE_strib2; } + + inline void setFenixPar11(int x) { m_fe_EB_tcpout = x; } + inline float getFenixPar11() const { return m_fe_EB_tcpout; } + inline void setFenixPar12(int x) { m_fe_EB_tcpib1 = x; } + inline float getFenixPar12() const { return m_fe_EB_tcpib1; } + + inline void setFenixPar13(int x) { m_fe_EE_tcpout = x; } + inline float getFenixPar13() const { return m_fe_EE_tcpout; } + inline void setFenixPar14(int x) { m_fe_EE_tcpib1 = x; } + inline float getFenixPar14() const { return m_fe_EE_tcpib1; } + + // extra parameters + + inline void setFenixPar15(int x) { m_fe_par15 = x; } + inline float getFenixPar15() const { return m_fe_par15; } + inline void setFenixPar16(int x) { m_fe_par16 = x; } + inline float getFenixPar16() const { return m_fe_par16; } + inline void setFenixPar17(int x) { m_fe_par17 = x; } + inline float getFenixPar17() const { return m_fe_par17; } + inline void setFenixPar18(int x) { m_fe_par18 = x; } + inline float getFenixPar18() const { return m_fe_par18; } + +private: + void prepareWrite() noexcept(false) override; + + void writeDB(const EcalLogicID* ecid, + const FEConfigOddWeightModeDat* item, + FEConfigOddWeightInfo* iconf) noexcept(false); + + void writeArrayDB(const std::map* data, + FEConfigOddWeightInfo* iconf) noexcept(false); + + void fetchData(std::map* fillMap, + FEConfigOddWeightInfo* iconf) noexcept(false); + + // User data + + int m_en_EB_flt; + int m_en_EE_flt; + int m_en_EB_pf; + int m_en_EE_pf; + int m_dis_EB_even_pf; + int m_dis_EE_even_pf; + int m_fe_EB_strout; + int m_fe_EE_strout; + int m_fe_EB_strib2; + int m_fe_EE_strib2; + int m_fe_EB_tcpout; + int m_fe_EB_tcpib1; + int m_fe_EE_tcpout; + int m_fe_EE_tcpib1; + int m_fe_par15; + int m_fe_par16; + int m_fe_par17; + int m_fe_par18; +}; + +#endif diff --git a/OnlineDB/EcalCondDB/interface/all_fe_config_types.h b/OnlineDB/EcalCondDB/interface/all_fe_config_types.h index c020d9a1d53dd..556a9f4de6148 100644 --- a/OnlineDB/EcalCondDB/interface/all_fe_config_types.h +++ b/OnlineDB/EcalCondDB/interface/all_fe_config_types.h @@ -1,40 +1,43 @@ -#ifndef ALLFECONFIG -#define ALLFECONFIG +#ifndef ONLINEDB_ECALCONDDB_ALL_FE_CONFIG_TYPES_H +#define ONLINEDB_ECALCONDDB_ALL_FE_CONFIG_TYPES_H -#include "OnlineDB/EcalCondDB/interface/FEConfigPedInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigPedDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigFgrInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigBadStripDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigBadStripInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigBadTTDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigBadTTInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigBadXTDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigBadXTInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigCokeDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h" #include "OnlineDB/EcalCondDB/interface/FEConfigFgrDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigFgrEEStripDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigFgrEETowerDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigFgrGroupDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigLinDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigLinInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigLUTInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigFgrInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigFgrParamDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigLUTDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigLUTGroupDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigLUTInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigLUTParamDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigLinDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigLinInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigLinParamDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightGroupDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightModeDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigParamDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigPedDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigPedInfo.h" #include "OnlineDB/EcalCondDB/interface/FEConfigSlidingDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigSlidingInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigWeightInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigWeightGroupDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigWeightDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigBadXTDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigBadTTDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigBadXTInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigBadTTInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigMainInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigFgrEEStripDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigFgrEETowerDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigFgrParamDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigLinParamDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigLUTParamDat.h" - -#include "OnlineDB/EcalCondDB/interface/FEConfigTimingInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigSpikeDat.h" #include "OnlineDB/EcalCondDB/interface/FEConfigSpikeInfo.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigBadStripInfo.h" - #include "OnlineDB/EcalCondDB/interface/FEConfigTimingDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigSpikeDat.h" -#include "OnlineDB/EcalCondDB/interface/FEConfigBadStripDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigTimingInfo.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigWeightDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigWeightGroupDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigWeightInfo.h" #endif diff --git a/OnlineDB/EcalCondDB/src/FEConfigCokeDat.cc b/OnlineDB/EcalCondDB/src/FEConfigCokeDat.cc new file mode 100644 index 0000000000000..ddc2e0941c3da --- /dev/null +++ b/OnlineDB/EcalCondDB/src/FEConfigCokeDat.cc @@ -0,0 +1,337 @@ +#include +#include +#include "OnlineDB/Oracle/interface/Oracle.h" + +#include "OnlineDB/EcalCondDB/interface/FEConfigCokeDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h" + +using namespace std; +using namespace oracle::occi; + +FEConfigCokeDat::FEConfigCokeDat() { + m_env = nullptr; + m_conn = nullptr; + m_writeStmt = nullptr; + m_readStmt = nullptr; + + clear(); +} + +FEConfigCokeDat::~FEConfigCokeDat() {} + +void FEConfigCokeDat::prepareWrite() noexcept(false) { + this->checkConnection(); + + try { + m_writeStmt = m_conn->createStatement(); + m_writeStmt->setSQL( + "INSERT INTO " + getTable() + + " (coke_conf_id, logic_id, " + " THRESHOLD, SUCC_EVENT_LIMIT, CUMUL_EVENT_LIMIT, SUCC_DETECT_ENABLE, CUMUL_DETECT_ENABLE, THD1_THRESHOLD, " + "SUCC1_EV_LIMIT, CUMUL1_EV_LIMIT, COMBI_MODE, OCC_MODE, COMB_SUCC_DETECT, COMB_CUMUL_DETECT, OCC_DETECT, " + "CUMUL1_DETECT, THD2_THRESHOLD , OCC_LIMIT , THD3_THRESHOLD , CUMUL2_LIMIT , STOP_BUFW ) " + "VALUES (:coke_conf_id, :logic_id, " + ":m1, :m2, :m3, :m4, :m5, :m6, :m7, :m8, :m9, :m10, :m11, :m12, :m13, :m14, :m15, :m16, :m17, :m18, :m19 )"); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigCokeDat::prepareWrite(): " + e.getMessage())); + } +} + +void FEConfigCokeDat::writeDB(const EcalLogicID* ecid, + const FEConfigCokeDat* item, + FEConfigCokeInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigCokeDat::writeDB: ICONF not in DB")); + } + + int logicID = ecid->getLogicID(); + if (!logicID) { + throw(std::runtime_error("FEConfigCokeDat::writeDB: Bad EcalLogicID")); + } + + try { + m_writeStmt->setInt(1, iconfID); + m_writeStmt->setInt(2, logicID); + m_writeStmt->setInt(3, item->getPar1()); + m_writeStmt->setInt(4, item->getPar2()); + m_writeStmt->setInt(5, item->getPar3()); + m_writeStmt->setInt(6, item->getPar4()); + m_writeStmt->setInt(7, item->getPar5()); + m_writeStmt->setInt(8, item->getPar6()); + m_writeStmt->setInt(9, item->getPar7()); + m_writeStmt->setInt(10, item->getPar8()); + m_writeStmt->setInt(11, item->getPar9()); + m_writeStmt->setInt(12, item->getPar10()); + m_writeStmt->setInt(13, item->getPar11()); + m_writeStmt->setInt(14, item->getPar12()); + m_writeStmt->setInt(15, item->getPar13()); + m_writeStmt->setInt(16, item->getPar14()); + m_writeStmt->setInt(17, item->getPar15()); + m_writeStmt->setInt(18, item->getPar16()); + m_writeStmt->setInt(19, item->getPar17()); + m_writeStmt->setInt(20, item->getPar18()); + m_writeStmt->setInt(21, item->getPar19()); + + m_writeStmt->executeUpdate(); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigCokeDat::writeDB(): " + e.getMessage())); + } +} + +void FEConfigCokeDat::fetchData(map* fillMap, FEConfigCokeInfo* iconf) noexcept(false) { + this->checkConnection(); + fillMap->clear(); + + iconf->setConnection(m_env, m_conn); + int iconfID = iconf->fetchID(); + if (!iconfID) { + // throw(std::runtime_error("FEConfigCokeDat::writeDB: ICONF not in DB")); + return; + } + + try { + m_readStmt->setSQL( + "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " + " d.THRESHOLD, d.SUCC_EVENT_LIMIT, d.CUMUL_EVENT_LIMIT, d.SUCC_DETECT_ENABLE, d.CUMUL_DETECT_ENABLE, " + "d.THD1_THRESHOLD, d.SUCC1_EV_LIMIT, d.CUMUL1_EV_LIMIT, d.COMBI_MODE, d.OCC_MODE, d.COMB_SUCC_DETECT, " + "d.COMB_CUMUL_DETECT, d.OCC_DETECT, d.CUMUL1_DETECT, d.THD2_THRESHOLD , d.OCC_LIMIT , d.THD3_THRESHOLD , " + "d.CUMUL2_LIMIT , d.STOP_BUFW " + "FROM channelview cv JOIN " + + getTable() + + " d " + "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " + "WHERE coke_conf_id = :coke_conf_id"); + m_readStmt->setInt(1, iconfID); + ResultSet* rset = m_readStmt->executeQuery(); + + std::pair p; + FEConfigCokeDat dat; + while (rset->next()) { + p.first = EcalLogicID(rset->getString(1), // name + rset->getInt(2), // logic_id + rset->getInt(3), // id1 + rset->getInt(4), // id2 + rset->getInt(5), // id3 + rset->getString(6)); // maps_to + + dat.setPar1(rset->getInt(7)); + dat.setPar2(rset->getInt(8)); + dat.setPar3(rset->getInt(9)); + dat.setPar4(rset->getInt(10)); + dat.setPar5(rset->getInt(11)); + dat.setPar6(rset->getInt(12)); + dat.setPar7(rset->getInt(13)); + dat.setPar8(rset->getInt(14)); + dat.setPar9(rset->getInt(15)); + dat.setPar10(rset->getInt(16)); + dat.setPar11(rset->getInt(17)); + dat.setPar12(rset->getInt(18)); + dat.setPar13(rset->getInt(19)); + dat.setPar14(rset->getInt(20)); + dat.setPar15(rset->getInt(21)); + dat.setPar16(rset->getInt(22)); + dat.setPar17(rset->getInt(23)); + dat.setPar18(rset->getInt(24)); + dat.setPar19(rset->getInt(25)); + + p.second = dat; + fillMap->insert(p); + } + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigCokeDat::fetchData: " + e.getMessage())); + } +} + +void FEConfigCokeDat::writeArrayDB(const std::map* data, + FEConfigCokeInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigCokeDat::writeArrayDB: ICONF not in DB")); + } + + int nrows = data->size(); + int* ids = new int[nrows]; + int* iconfid_vec = new int[nrows]; + int* xx1 = new int[nrows]; + int* xx2 = new int[nrows]; + int* xx3 = new int[nrows]; + int* xx4 = new int[nrows]; + int* xx5 = new int[nrows]; + int* xx6 = new int[nrows]; + int* xx7 = new int[nrows]; + int* xx8 = new int[nrows]; + int* xx9 = new int[nrows]; + int* xx10 = new int[nrows]; + int* xx11 = new int[nrows]; + int* xx12 = new int[nrows]; + int* xx13 = new int[nrows]; + int* xx14 = new int[nrows]; + int* xx15 = new int[nrows]; + int* xx16 = new int[nrows]; + int* xx17 = new int[nrows]; + int* xx18 = new int[nrows]; + int* xx19 = new int[nrows]; + + ub2* ids_len = new ub2[nrows]; + ub2* iconf_len = new ub2[nrows]; + ub2* x1_len = new ub2[nrows]; + ub2* x2_len = new ub2[nrows]; + ub2* x3_len = new ub2[nrows]; + ub2* x4_len = new ub2[nrows]; + ub2* x5_len = new ub2[nrows]; + ub2* x6_len = new ub2[nrows]; + ub2* x7_len = new ub2[nrows]; + ub2* x8_len = new ub2[nrows]; + ub2* x9_len = new ub2[nrows]; + ub2* x10_len = new ub2[nrows]; + ub2* x11_len = new ub2[nrows]; + ub2* x12_len = new ub2[nrows]; + ub2* x13_len = new ub2[nrows]; + ub2* x14_len = new ub2[nrows]; + ub2* x15_len = new ub2[nrows]; + ub2* x16_len = new ub2[nrows]; + ub2* x17_len = new ub2[nrows]; + ub2* x18_len = new ub2[nrows]; + ub2* x19_len = new ub2[nrows]; + + const EcalLogicID* channel; + const FEConfigCokeDat* dataitem; + int count = 0; + typedef map::const_iterator CI; + for (CI p = data->begin(); p != data->end(); ++p) { + channel = &(p->first); + int logicID = channel->getLogicID(); + if (!logicID) { + throw(std::runtime_error("FEConfigCokeDat::writeArrayDB: Bad EcalLogicID")); + } + ids[count] = logicID; + iconfid_vec[count] = iconfID; + + dataitem = &(p->second); + + xx1[count] = dataitem->getPar1(); + xx2[count] = dataitem->getPar2(); + xx3[count] = dataitem->getPar3(); + xx4[count] = dataitem->getPar4(); + xx5[count] = dataitem->getPar5(); + xx6[count] = dataitem->getPar6(); + xx7[count] = dataitem->getPar7(); + xx8[count] = dataitem->getPar8(); + xx9[count] = dataitem->getPar9(); + xx10[count] = dataitem->getPar10(); + xx11[count] = dataitem->getPar11(); + xx12[count] = dataitem->getPar12(); + xx13[count] = dataitem->getPar13(); + xx14[count] = dataitem->getPar14(); + xx15[count] = dataitem->getPar15(); + xx16[count] = dataitem->getPar16(); + xx17[count] = dataitem->getPar17(); + xx18[count] = dataitem->getPar18(); + xx19[count] = dataitem->getPar19(); + + ids_len[count] = sizeof(ids[count]); + iconf_len[count] = sizeof(iconfid_vec[count]); + + x1_len[count] = sizeof(xx1[count]); + x2_len[count] = sizeof(xx2[count]); + x3_len[count] = sizeof(xx3[count]); + x4_len[count] = sizeof(xx4[count]); + x5_len[count] = sizeof(xx5[count]); + x6_len[count] = sizeof(xx6[count]); + x7_len[count] = sizeof(xx7[count]); + x8_len[count] = sizeof(xx8[count]); + x9_len[count] = sizeof(xx9[count]); + x10_len[count] = sizeof(xx10[count]); + x11_len[count] = sizeof(xx11[count]); + x12_len[count] = sizeof(xx12[count]); + x13_len[count] = sizeof(xx13[count]); + x14_len[count] = sizeof(xx14[count]); + x15_len[count] = sizeof(xx15[count]); + x16_len[count] = sizeof(xx16[count]); + x17_len[count] = sizeof(xx17[count]); + x18_len[count] = sizeof(xx18[count]); + x19_len[count] = sizeof(xx19[count]); + + count++; + } + + try { + m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len); + m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len); + m_writeStmt->setDataBuffer(3, (dvoid*)xx1, OCCIINT, sizeof(xx1[0]), x1_len); + m_writeStmt->setDataBuffer(4, (dvoid*)xx2, OCCIINT, sizeof(xx2[0]), x2_len); + m_writeStmt->setDataBuffer(5, (dvoid*)xx3, OCCIINT, sizeof(xx3[0]), x3_len); + m_writeStmt->setDataBuffer(6, (dvoid*)xx4, OCCIINT, sizeof(xx4[0]), x4_len); + m_writeStmt->setDataBuffer(7, (dvoid*)xx5, OCCIINT, sizeof(xx5[0]), x5_len); + m_writeStmt->setDataBuffer(8, (dvoid*)xx6, OCCIINT, sizeof(xx6[0]), x6_len); + m_writeStmt->setDataBuffer(9, (dvoid*)xx7, OCCIINT, sizeof(xx7[0]), x7_len); + m_writeStmt->setDataBuffer(10, (dvoid*)xx8, OCCIINT, sizeof(xx8[0]), x8_len); + m_writeStmt->setDataBuffer(11, (dvoid*)xx9, OCCIINT, sizeof(xx9[0]), x9_len); + m_writeStmt->setDataBuffer(12, (dvoid*)xx10, OCCIINT, sizeof(xx10[0]), x10_len); + m_writeStmt->setDataBuffer(13, (dvoid*)xx11, OCCIINT, sizeof(xx11[0]), x11_len); + m_writeStmt->setDataBuffer(14, (dvoid*)xx12, OCCIINT, sizeof(xx12[0]), x12_len); + m_writeStmt->setDataBuffer(15, (dvoid*)xx13, OCCIINT, sizeof(xx13[0]), x13_len); + m_writeStmt->setDataBuffer(16, (dvoid*)xx14, OCCIINT, sizeof(xx14[0]), x14_len); + m_writeStmt->setDataBuffer(17, (dvoid*)xx15, OCCIINT, sizeof(xx15[0]), x15_len); + m_writeStmt->setDataBuffer(18, (dvoid*)xx16, OCCIINT, sizeof(xx16[0]), x16_len); + m_writeStmt->setDataBuffer(19, (dvoid*)xx17, OCCIINT, sizeof(xx17[0]), x17_len); + m_writeStmt->setDataBuffer(20, (dvoid*)xx18, OCCIINT, sizeof(xx18[0]), x18_len); + m_writeStmt->setDataBuffer(21, (dvoid*)xx19, OCCIINT, sizeof(xx19[0]), x19_len); + + m_writeStmt->executeArrayUpdate(nrows); + + delete[] ids; + delete[] iconfid_vec; + delete[] xx1; + delete[] xx2; + delete[] xx3; + delete[] xx4; + delete[] xx5; + delete[] xx6; + delete[] xx7; + delete[] xx8; + delete[] xx9; + delete[] xx10; + delete[] xx11; + delete[] xx12; + delete[] xx13; + delete[] xx14; + delete[] xx15; + delete[] xx16; + delete[] xx17; + delete[] xx18; + delete[] xx19; + + delete[] ids_len; + delete[] iconf_len; + delete[] x1_len; + delete[] x2_len; + delete[] x3_len; + delete[] x4_len; + delete[] x5_len; + delete[] x6_len; + delete[] x7_len; + delete[] x8_len; + delete[] x9_len; + delete[] x10_len; + delete[] x11_len; + delete[] x12_len; + delete[] x13_len; + delete[] x14_len; + delete[] x15_len; + delete[] x16_len; + delete[] x17_len; + delete[] x18_len; + delete[] x19_len; + + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigCokeDat::writeArrayDB(): " + e.getMessage())); + } +} diff --git a/OnlineDB/EcalCondDB/src/FEConfigCokeInfo.cc b/OnlineDB/EcalCondDB/src/FEConfigCokeInfo.cc new file mode 100644 index 0000000000000..e8af17b898044 --- /dev/null +++ b/OnlineDB/EcalCondDB/src/FEConfigCokeInfo.cc @@ -0,0 +1,214 @@ +#include +#include +#include +#include "OnlineDB/Oracle/interface/Oracle.h" +#include +#include "OnlineDB/EcalCondDB/interface/FEConfigCokeInfo.h" +#include "OnlineDB/EcalCondDB/interface/Tm.h" +#include "OnlineDB/EcalCondDB/interface/DateHandler.h" + +using namespace std; +using namespace oracle::occi; + +FEConfigCokeInfo::FEConfigCokeInfo() { + m_env = nullptr; + m_conn = nullptr; + m_writeStmt = nullptr; + m_readStmt = nullptr; + m_config_tag = ""; + m_version = 0; + m_ID = 0; + clear(); +} + +void FEConfigCokeInfo::clear() {} + +FEConfigCokeInfo::~FEConfigCokeInfo() {} + +int FEConfigCokeInfo::fetchNextId() noexcept(false) { + int result = 0; + try { + this->checkConnection(); + + m_readStmt = m_conn->createStatement(); + m_readStmt->setSQL("select FE_CONFIG_COKE_SQ.NextVal from DUAL "); + ResultSet* rset = m_readStmt->executeQuery(); + while (rset->next()) { + result = rset->getInt(1); + } + result++; + m_conn->terminateStatement(m_readStmt); + return result; + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::fetchNextId(): ") + e.getMessage())); + } +} + +void FEConfigCokeInfo::prepareWrite() noexcept(false) { + this->checkConnection(); + + int next_id = 0; + if (getId() == 0) { + next_id = fetchNextId(); + } + + try { + m_writeStmt = m_conn->createStatement(); + m_writeStmt->setSQL("INSERT INTO " + getTable() + + " ( coke_conf_id, tag, version) " + " VALUES ( :1, :2, :3 ) "); + + m_writeStmt->setInt(1, next_id); + m_ID = next_id; + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::prepareWrite(): ") + e.getMessage())); + } +} + +void FEConfigCokeInfo::setParameters(const std::map& my_keys_map) { + // parses the result of the XML parser that is a map of + // string string with variable name variable value + + for (std::map::const_iterator ci = my_keys_map.begin(); ci != my_keys_map.end(); ci++) { + if (ci->first == "VERSION") + setVersion(atoi(ci->second.c_str())); + if (ci->first == "TAG") + setConfigTag(ci->second); + } +} + +void FEConfigCokeInfo::writeDB() noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + try { + // number 1 is the id + m_writeStmt->setString(2, this->getConfigTag()); + m_writeStmt->setInt(3, this->getVersion()); + + m_writeStmt->executeUpdate(); + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::writeDB(): ") + e.getMessage())); + } + // Now get the ID + if (!this->fetchID()) { + throw(std::runtime_error("FEConfigCokeInfo::writeDB: Failed to write")); + } +} + +void FEConfigCokeInfo::fetchData(FEConfigCokeInfo* result) noexcept(false) { + this->checkConnection(); + result->clear(); + if (result->getId() == 0 && (result->getConfigTag().empty())) { + throw(std::runtime_error("FEConfigCokeInfo::fetchData(): no Id defined for this FEConfigCokeInfo ")); + } + + try { + DateHandler dh(m_env, m_conn); + + m_readStmt->setSQL("SELECT * FROM " + getTable() + " where ( coke_conf_id= :1 or (tag=:2 AND version=:3 ) )"); + m_readStmt->setInt(1, result->getId()); + m_readStmt->setString(2, result->getConfigTag()); + m_readStmt->setInt(3, result->getVersion()); + ResultSet* rset = m_readStmt->executeQuery(); + + rset->next(); + + // 1 is the id and 2 is the config tag and 3 is the version + + result->setId(rset->getInt(1)); + result->setConfigTag(rset->getString(2)); + result->setVersion(rset->getInt(3)); + + Date dbdate = rset->getDate(4); + result->setDBTime(dh.dateToTm(dbdate)); + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::fetchData(): ") + e.getMessage())); + } +} + +void FEConfigCokeInfo::fetchLastData(FEConfigCokeInfo* result) noexcept(false) { + this->checkConnection(); + result->clear(); + try { + DateHandler dh(m_env, m_conn); + + m_readStmt->setSQL("SELECT * FROM " + getTable() + " where coke_conf_id = ( select max( coke_conf_id) from " + + getTable() + " ) "); + ResultSet* rset = m_readStmt->executeQuery(); + + rset->next(); + + result->setId(rset->getInt(1)); + result->setConfigTag(rset->getString(2)); + result->setVersion(rset->getInt(3)); + Date dbdate = rset->getDate(4); + result->setDBTime(dh.dateToTm(dbdate)); + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::fetchData(): ") + e.getMessage())); + } +} + +int FEConfigCokeInfo::fetchID() noexcept(false) { + // Return from memory if available + if (m_ID != 0) { + return m_ID; + } + + this->checkConnection(); + + try { + Statement* stmt = m_conn->createStatement(); + stmt->setSQL("SELECT coke_conf_id FROM " + getTable() + " WHERE tag=:1 and version=:2 "); + + stmt->setString(1, getConfigTag()); + stmt->setInt(2, getVersion()); + + ResultSet* rset = stmt->executeQuery(); + + if (rset->next()) { + m_ID = rset->getInt(1); + } else { + m_ID = 0; + } + m_conn->terminateStatement(stmt); + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::fetchID: ") + e.getMessage())); + } + + return m_ID; +} + +void FEConfigCokeInfo::setByID(int id) noexcept(false) { + this->checkConnection(); + + DateHandler dh(m_env, m_conn); + + try { + Statement* stmt = m_conn->createStatement(); + + stmt->setSQL("SELECT * FROM " + getTable() + " WHERE coke_conf_id = :1"); + stmt->setInt(1, id); + + ResultSet* rset = stmt->executeQuery(); + if (rset->next()) { + this->setId(rset->getInt(1)); + this->setConfigTag(rset->getString(2)); + this->setVersion(rset->getInt(3)); + + Date dbdate = rset->getDate(4); + this->setDBTime(dh.dateToTm(dbdate)); + } else { + throw(std::runtime_error("FEConfigCokeInfo::setByID: Given config_id is not in the database")); + } + + m_conn->terminateStatement(stmt); + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigCokeInfo::setByID: ") + e.getMessage())); + } +} diff --git a/OnlineDB/EcalCondDB/src/FEConfigMainInfo.cc b/OnlineDB/EcalCondDB/src/FEConfigMainInfo.cc index 383af4f9e0bfd..0dd5473f033ef 100644 --- a/OnlineDB/EcalCondDB/src/FEConfigMainInfo.cc +++ b/OnlineDB/EcalCondDB/src/FEConfigMainInfo.cc @@ -34,6 +34,8 @@ void FEConfigMainInfo::clear() { m_tim_id = 0; m_spi_id = 0; m_bst_id = 0; + m_coke_id = 0; + m_wei2_id = 0; m_db_time = Tm(); } @@ -113,8 +115,9 @@ void FEConfigMainInfo::prepareWrite() noexcept(false) { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL( "INSERT INTO fe_config_main (conf_id, ped_conf_id, lin_conf_id, lut_conf_id, fgr_conf_id, sli_conf_id, " - "wei_conf_id, spi_conf_id, tim_conf_id, bxt_conf_id, btt_conf_id, bst_conf_id, tag, version, description) " - " VALUES (:1, :2, :3 , :4, :5, :6 ,:7, :8, :9, :10, :11, :12, :13, :14, :15 )"); + "wei_conf_id, spi_conf_id, tim_conf_id, bxt_conf_id, btt_conf_id, bst_conf_id, coke_conf_id, wei2_conf_id, " + "tag, version, description) " + " VALUES (:1, :2, :3 , :4, :5, :6 ,:7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17 )"); m_writeStmt->setInt(1, next_id); m_ID = next_id; @@ -143,9 +146,11 @@ void FEConfigMainInfo::writeDB() noexcept(false) { m_writeStmt->setInt(10, this->getBxtId()); m_writeStmt->setInt(11, this->getBttId()); m_writeStmt->setInt(12, this->getBstId()); - m_writeStmt->setString(13, this->getConfigTag()); - m_writeStmt->setInt(14, this->getVersion()); - m_writeStmt->setString(15, this->getDescription()); + m_writeStmt->setInt(13, this->getCokeId()); + m_writeStmt->setInt(14, this->getWei2Id()); + m_writeStmt->setString(15, this->getConfigTag()); + m_writeStmt->setInt(16, this->getVersion()); + m_writeStmt->setString(17, this->getDescription()); m_writeStmt->executeUpdate(); } catch (SQLException& e) { @@ -194,7 +199,10 @@ void FEConfigMainInfo::setByID(int id) noexcept(false) { try { Statement* stmt = m_conn->createStatement(); - stmt->setSQL("SELECT * FROM FE_CONFIG_MAIN WHERE conf_id = :1 "); + stmt->setSQL( + "SELECT conf_id, ped_conf_id, lin_conf_id, lut_conf_id, fgr_conf_id, sli_conf_id, wei_conf_id, spi_conf_id, " + "tim_conf_id, bxt_conf_id, btt_conf_id, bst_conf_id, coke_conf_id, wei2_conf_id, tag, version, description, " + "db_timestamp FROM FE_CONFIG_MAIN WHERE conf_id = :1 "); stmt->setInt(1, id); ResultSet* rset = stmt->executeQuery(); @@ -211,10 +219,12 @@ void FEConfigMainInfo::setByID(int id) noexcept(false) { setBxtId(rset->getInt(10)); setBttId(rset->getInt(11)); setBstId(rset->getInt(12)); - setConfigTag(rset->getString(13)); - setVersion(rset->getInt(14)); - setDescription(rset->getString(15)); - Date dbdate = rset->getDate(16); + setCokeId(rset->getInt(13)); + setWei2Id(rset->getInt(14)); + setConfigTag(rset->getString(15)); + setVersion(rset->getInt(16)); + setDescription(rset->getString(17)); + Date dbdate = rset->getDate(18); setDBTime(dh.dateToTm(dbdate)); m_ID = id; } else { @@ -243,7 +253,10 @@ void FEConfigMainInfo::fetchData(FEConfigMainInfo* result) noexcept(false) { } try { - m_readStmt->setSQL("SELECT * FROM FE_CONFIG_MAIN WHERE conf_id = :1 "); + m_readStmt->setSQL( + "SELECT conf_id, ped_conf_id, lin_conf_id, lut_conf_id, fgr_conf_id, sli_conf_id, wei_conf_id, spi_conf_id, " + "tim_conf_id, bxt_conf_id, btt_conf_id, bst_conf_id, coke_conf_id, wei2_conf_id, tag, version, description, " + "db_timestamp FROM FE_CONFIG_MAIN WHERE conf_id = :1 "); std::cout << " ### 2 getId from FEConfigMainInfo = " << result->getId() << std::endl; @@ -266,11 +279,13 @@ void FEConfigMainInfo::fetchData(FEConfigMainInfo* result) noexcept(false) { setBxtId(rset->getInt(10)); setBttId(rset->getInt(11)); setBstId(rset->getInt(12)); + setCokeId(rset->getInt(13)); + setWei2Id(rset->getInt(14)); - result->setConfigTag(rset->getString(13)); - result->setVersion(rset->getInt(14)); - result->setDescription(rset->getString(15)); - Date dbdate = rset->getDate(16); + result->setConfigTag(rset->getString(15)); + result->setVersion(rset->getInt(16)); + result->setDescription(rset->getString(17)); + Date dbdate = rset->getDate(18); result->setDBTime(dh.dateToTm(dbdate)); } catch (SQLException& e) { diff --git a/OnlineDB/EcalCondDB/src/FEConfigOddWeightDat.cc b/OnlineDB/EcalCondDB/src/FEConfigOddWeightDat.cc new file mode 100644 index 0000000000000..eaa9da3880010 --- /dev/null +++ b/OnlineDB/EcalCondDB/src/FEConfigOddWeightDat.cc @@ -0,0 +1,170 @@ +#include +#include +#include "OnlineDB/Oracle/interface/Oracle.h" + +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" + +using namespace std; +using namespace oracle::occi; + +FEConfigOddWeightDat::FEConfigOddWeightDat() { + m_env = nullptr; + m_conn = nullptr; + m_writeStmt = nullptr; + m_readStmt = nullptr; + + m_group_id = 0; +} + +FEConfigOddWeightDat::~FEConfigOddWeightDat() {} + +void FEConfigOddWeightDat::prepareWrite() noexcept(false) { + this->checkConnection(); + + try { + m_writeStmt = m_conn->createStatement(); + m_writeStmt->setSQL( + "INSERT INTO fe_config_weight2_dat (wei2_conf_id, logic_id, " + "group_id ) " + "VALUES (:wei2_conf_id, :logic_id, " + ":group_id )"); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightDat::prepareWrite(): " + e.getMessage())); + } +} + +void FEConfigOddWeightDat::writeDB(const EcalLogicID* ecid, + const FEConfigOddWeightDat* item, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightDat::writeDB: ICONF not in DB")); + } + + int logicID = ecid->getLogicID(); + if (!logicID) { + throw(std::runtime_error("FEConfigOddWeightDat::writeDB: Bad EcalLogicID")); + } + + try { + m_writeStmt->setInt(1, iconfID); + m_writeStmt->setInt(2, logicID); + m_writeStmt->setInt(3, item->getWeightGroupId()); + + m_writeStmt->executeUpdate(); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightDat::writeDB(): " + e.getMessage())); + } +} + +void FEConfigOddWeightDat::fetchData(map* fillMap, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + fillMap->clear(); + + iconf->setConnection(m_env, m_conn); + int iconfID = iconf->fetchID(); + if (!iconfID) { + // throw(std::runtime_error("FEConfigOddWeightDat::writeDB: ICONF not in DB")); + return; + } + + try { + m_readStmt->setSQL( + "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " + "d.group_id " + "FROM channelview cv JOIN fe_config_weight2_dat d " + "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " + "WHERE wei2_conf_id = :wei2_conf_id"); + m_readStmt->setInt(1, iconfID); + ResultSet* rset = m_readStmt->executeQuery(); + + std::pair p; + FEConfigOddWeightDat dat; + while (rset->next()) { + p.first = EcalLogicID(rset->getString(1), // name + rset->getInt(2), // logic_id + rset->getInt(3), // id1 + rset->getInt(4), // id2 + rset->getInt(5), // id3 + rset->getString(6)); // maps_to + + dat.setWeightGroupId(rset->getInt(7)); + + p.second = dat; + fillMap->insert(p); + } + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightDat::fetchData: " + e.getMessage())); + } +} + +void FEConfigOddWeightDat::writeArrayDB(const std::map* data, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightDat::writeArrayDB: ICONF not in DB")); + } + + int nrows = data->size(); + int* ids = new int[nrows]; + int* iconfid_vec = new int[nrows]; + int* xx = new int[nrows]; + + ub2* ids_len = new ub2[nrows]; + ub2* iconf_len = new ub2[nrows]; + ub2* x_len = new ub2[nrows]; + + const EcalLogicID* channel; + const FEConfigOddWeightDat* dataitem; + int count = 0; + typedef map::const_iterator CI; + for (CI p = data->begin(); p != data->end(); ++p) { + channel = &(p->first); + int logicID = channel->getLogicID(); + if (!logicID) { + throw(std::runtime_error("FEConfigOddWeightDat::writeArrayDB: Bad EcalLogicID")); + } + ids[count] = logicID; + iconfid_vec[count] = iconfID; + + dataitem = &(p->second); + // dataIface.writeDB( channel, dataitem, iconf); + int x = dataitem->getWeightGroupId(); + + xx[count] = x; + + ids_len[count] = sizeof(ids[count]); + iconf_len[count] = sizeof(iconfid_vec[count]); + + x_len[count] = sizeof(xx[count]); + + count++; + } + + try { + m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len); + m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len); + m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len); + + m_writeStmt->executeArrayUpdate(nrows); + + delete[] ids; + delete[] iconfid_vec; + delete[] xx; + + delete[] ids_len; + delete[] iconf_len; + delete[] x_len; + + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightDat::writeArrayDB(): " + e.getMessage())); + } +} diff --git a/OnlineDB/EcalCondDB/src/FEConfigOddWeightGroupDat.cc b/OnlineDB/EcalCondDB/src/FEConfigOddWeightGroupDat.cc new file mode 100644 index 0000000000000..8ba03e9d17222 --- /dev/null +++ b/OnlineDB/EcalCondDB/src/FEConfigOddWeightGroupDat.cc @@ -0,0 +1,228 @@ +#include +#include +#include "OnlineDB/Oracle/interface/Oracle.h" + +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightGroupDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" + +using namespace std; +using namespace oracle::occi; + +FEConfigOddWeightGroupDat::FEConfigOddWeightGroupDat() { + m_env = nullptr; + m_conn = nullptr; + m_writeStmt = nullptr; + m_readStmt = nullptr; + + m_group_id = 0; + m_w0 = 0; + m_w1 = 0; + m_w2 = 0; + m_w3 = 0; + m_w4 = 0; + m_w5 = 0; +} + +FEConfigOddWeightGroupDat::~FEConfigOddWeightGroupDat() {} + +void FEConfigOddWeightGroupDat::prepareWrite() noexcept(false) { + this->checkConnection(); + + try { + m_writeStmt = m_conn->createStatement(); + m_writeStmt->setSQL( + "INSERT INTO fe_weight2_per_group_dat (wei2_conf_id, group_id, " + " w0, w1, w2, w3, w4, w5 ) " + "VALUES (:wei2_conf_id, :group_id, " + ":w0, :w1, :w2, :w3, :w4, :w5 )"); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::prepareWrite(): " + e.getMessage())); + } +} + +void FEConfigOddWeightGroupDat::writeDB(const EcalLogicID* ecid, + const FEConfigOddWeightGroupDat* item, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::writeDB: ICONF not in DB")); + } + /* no need for the logic id in this table + int logicID = ecid->getLogicID(); + if (!logicID) { throw(std::runtime_error("FEConfigOddWeightGroupDat::writeDB: Bad EcalLogicID")); } + */ + + try { + m_writeStmt->setInt(1, iconfID); + + m_writeStmt->setInt(2, item->getWeightGroupId()); + m_writeStmt->setFloat(3, item->getWeight0()); + m_writeStmt->setFloat(4, item->getWeight1()); + m_writeStmt->setFloat(5, item->getWeight2()); + m_writeStmt->setFloat(6, item->getWeight3()); + m_writeStmt->setFloat(7, item->getWeight4()); + m_writeStmt->setFloat(8, item->getWeight5()); + + m_writeStmt->executeUpdate(); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::writeDB(): " + e.getMessage())); + } +} + +void FEConfigOddWeightGroupDat::fetchData(map* fillMap, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + fillMap->clear(); + + iconf->setConnection(m_env, m_conn); + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::fetchData: ICONF not in DB")); + return; + } + + try { + m_readStmt->setSQL( + "SELECT d.group_id, d.w0, d.w1, d.w2, d.w3, d.w4, d.w5 " + "FROM fe_weight2_per_group_dat d " + "WHERE wei2_conf_id = :wei2_conf_id order by d.group_id "); + m_readStmt->setInt(1, iconfID); + ResultSet* rset = m_readStmt->executeQuery(); + + std::pair p; + FEConfigOddWeightGroupDat dat; + int ig = -1; + while (rset->next()) { + ig++; // we create a dummy logic_id + p.first = EcalLogicID("Group_id", // name + ig); // logic_id + + dat.setWeightGroupId(rset->getInt(1)); + dat.setWeight0(rset->getFloat(2)); + dat.setWeight1(rset->getFloat(3)); + dat.setWeight2(rset->getFloat(4)); + dat.setWeight3(rset->getFloat(5)); + dat.setWeight4(rset->getFloat(6)); + dat.setWeight5(rset->getFloat(7)); + + p.second = dat; + fillMap->insert(p); + } + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::fetchData: " + e.getMessage())); + } +} + +void FEConfigOddWeightGroupDat::writeArrayDB(const std::map* data, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::writeArrayDB: ICONF not in DB")); + } + + int nrows = data->size(); + int* ids = new int[nrows]; + int* iconfid_vec = new int[nrows]; + int* xx = new int[nrows]; + float* yy = new float[nrows]; + float* zz = new float[nrows]; + float* rr = new float[nrows]; + float* ss = new float[nrows]; + float* tt = new float[nrows]; + float* ww = new float[nrows]; + + ub2* ids_len = new ub2[nrows]; + ub2* iconf_len = new ub2[nrows]; + ub2* x_len = new ub2[nrows]; + ub2* y_len = new ub2[nrows]; + ub2* z_len = new ub2[nrows]; + ub2* r_len = new ub2[nrows]; + ub2* s_len = new ub2[nrows]; + ub2* t_len = new ub2[nrows]; + ub2* w_len = new ub2[nrows]; + + // const EcalLogicID* channel; + const FEConfigOddWeightGroupDat* dataitem; + int count = 0; + typedef map::const_iterator CI; + for (CI p = data->begin(); p != data->end(); ++p) { + // channel = &(p->first); + // int logicID = channel->getLogicID(); + // if (!logicID) { throw(std::runtime_error("FEConfigOddWeightGroupDat::writeArrayDB: Bad EcalLogicID")); } + // ids[count]=logicID; + iconfid_vec[count] = iconfID; + + dataitem = &(p->second); + // dataIface.writeDB( channel, dataitem, iconf); + int x = dataitem->getWeightGroupId(); + float y = dataitem->getWeight0(); + float z = dataitem->getWeight1(); + float r = dataitem->getWeight2(); + float s = dataitem->getWeight3(); + float t = dataitem->getWeight4(); + float w = dataitem->getWeight5(); + + xx[count] = x; + yy[count] = y; + zz[count] = z; + rr[count] = r; + ss[count] = s; + tt[count] = t; + ww[count] = w; + + // ids_len[count]=sizeof(ids[count]); + iconf_len[count] = sizeof(iconfid_vec[count]); + + x_len[count] = sizeof(xx[count]); + y_len[count] = sizeof(yy[count]); + z_len[count] = sizeof(zz[count]); + r_len[count] = sizeof(rr[count]); + s_len[count] = sizeof(ss[count]); + t_len[count] = sizeof(tt[count]); + w_len[count] = sizeof(ww[count]); + + count++; + } + + try { + m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len); + m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len); + m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len); + m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT, sizeof(zz[0]), z_len); + m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT, sizeof(rr[0]), r_len); + m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT, sizeof(ss[0]), s_len); + m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIFLOAT, sizeof(tt[0]), t_len); + m_writeStmt->setDataBuffer(8, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len); + + m_writeStmt->executeArrayUpdate(nrows); + + delete[] ids; + delete[] iconfid_vec; + delete[] xx; + delete[] yy; + delete[] zz; + delete[] rr; + delete[] ss; + delete[] tt; + delete[] ww; + + delete[] ids_len; + delete[] iconf_len; + delete[] x_len; + delete[] y_len; + delete[] z_len; + delete[] r_len; + delete[] s_len; + delete[] t_len; + delete[] w_len; + + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightGroupDat::writeArrayDB(): " + e.getMessage())); + } +} diff --git a/OnlineDB/EcalCondDB/src/FEConfigOddWeightInfo.cc b/OnlineDB/EcalCondDB/src/FEConfigOddWeightInfo.cc new file mode 100644 index 0000000000000..b85a040903393 --- /dev/null +++ b/OnlineDB/EcalCondDB/src/FEConfigOddWeightInfo.cc @@ -0,0 +1,212 @@ +#include +#include +#include +#include "OnlineDB/Oracle/interface/Oracle.h" +#include +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" +#include "OnlineDB/EcalCondDB/interface/Tm.h" +#include "OnlineDB/EcalCondDB/interface/DateHandler.h" + +using namespace std; +using namespace oracle::occi; + +FEConfigOddWeightInfo::FEConfigOddWeightInfo() { + m_env = nullptr; + m_conn = nullptr; + m_writeStmt = nullptr; + m_readStmt = nullptr; + m_config_tag = ""; + m_version = 0; + m_ID = 0; + clear(); +} + +void FEConfigOddWeightInfo::clear() { m_ngr = 0; } + +FEConfigOddWeightInfo::~FEConfigOddWeightInfo() {} + +int FEConfigOddWeightInfo::fetchNextId() noexcept(false) { + int result = 0; + try { + this->checkConnection(); + + m_readStmt = m_conn->createStatement(); + m_readStmt->setSQL("select FE_CONFIG_WEIGHT2GROUP_SQ.NextVal from DUAL "); + ResultSet* rset = m_readStmt->executeQuery(); + while (rset->next()) { + result = rset->getInt(1); + } + result++; + m_conn->terminateStatement(m_readStmt); + return result; + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::fetchNextId(): ") + e.getMessage())); + } +} + +void FEConfigOddWeightInfo::prepareWrite() noexcept(false) { + this->checkConnection(); + + int next_id = 0; + if (getId() == 0) { + next_id = fetchNextId(); + } + + try { + m_writeStmt = m_conn->createStatement(); + m_writeStmt->setSQL("INSERT INTO " + getTable() + + " ( wei2_conf_id, tag, number_of_groups) " + " VALUES ( :1, :2, :3 ) "); + + m_writeStmt->setInt(1, next_id); + m_ID = next_id; + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::prepareWrite(): ") + e.getMessage())); + } +} + +void FEConfigOddWeightInfo::setParameters(const std::map& my_keys_map) { + // parses the result of the XML parser that is a map of + // string string with variable name variable value + + for (std::map::const_iterator ci = my_keys_map.begin(); ci != my_keys_map.end(); ci++) { + if (ci->first == "TAG") + setConfigTag(ci->second); + if (ci->first == "NUMBER_OF_GROUPS") + setNumberOfGroups(atoi(ci->second.c_str())); + } +} + +void FEConfigOddWeightInfo::writeDB() noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + try { + // number 1 is the id + m_writeStmt->setString(2, this->getConfigTag()); + m_writeStmt->setInt(3, this->getNumberOfGroups()); + + m_writeStmt->executeUpdate(); + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::writeDB(): ") + e.getMessage())); + } + // Now get the ID + if (!this->fetchID()) { + throw(std::runtime_error("FEConfigOddWeightInfo::writeDB: Failed to write")); + } +} + +void FEConfigOddWeightInfo::fetchData(FEConfigOddWeightInfo* result) noexcept(false) { + this->checkConnection(); + result->clear(); + if (result->getId() == 0 && (result->getConfigTag().empty())) { + throw(std::runtime_error("FEConfigOddWeightInfo::fetchData(): no Id defined for this FEConfigOddWeightInfo ")); + } + + try { + DateHandler dh(m_env, m_conn); + + m_readStmt->setSQL("SELECT wei2_conf_id, tag, number_of_groups, db_timestamp FROM " + getTable() + + " where ( wei2_conf_id= :1 or (tag=:2 ) )"); + m_readStmt->setInt(1, result->getId()); + m_readStmt->setString(2, result->getConfigTag()); + ResultSet* rset = m_readStmt->executeQuery(); + + rset->next(); + + // 1 is the id and 2 is the config tag and 3 is the version + + result->setId(rset->getInt(1)); + result->setConfigTag(rset->getString(2)); + result->setNumberOfGroups(rset->getInt(3)); + Date dbdate = rset->getDate(4); + result->setDBTime(dh.dateToTm(dbdate)); + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::fetchData(): ") + e.getMessage())); + } +} + +void FEConfigOddWeightInfo::fetchLastData(FEConfigOddWeightInfo* result) noexcept(false) { + this->checkConnection(); + result->clear(); + try { + DateHandler dh(m_env, m_conn); + + m_readStmt->setSQL("SELECT wei2_conf_id, tag, number_of_groups, db_timestamp FROM " + getTable() + + " where wei2_conf_id = ( select max( wei2_conf_id) from " + getTable() + " ) "); + ResultSet* rset = m_readStmt->executeQuery(); + + rset->next(); + + result->setId(rset->getInt(1)); + result->setConfigTag(rset->getString(2)); + result->setNumberOfGroups(rset->getInt(3)); + Date dbdate = rset->getDate(4); + result->setDBTime(dh.dateToTm(dbdate)); + + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::fetchData(): ") + e.getMessage())); + } +} + +int FEConfigOddWeightInfo::fetchID() noexcept(false) { + // Return from memory if available + if (m_ID != 0) { + return m_ID; + } + + this->checkConnection(); + + try { + Statement* stmt = m_conn->createStatement(); + stmt->setSQL("SELECT wei2_conf_id FROM " + getTable() + " WHERE tag=:1 "); + + stmt->setString(1, getConfigTag()); + + ResultSet* rset = stmt->executeQuery(); + + if (rset->next()) { + m_ID = rset->getInt(1); + } else { + m_ID = 0; + } + m_conn->terminateStatement(stmt); + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::fetchID: ") + e.getMessage())); + } + + return m_ID; +} + +void FEConfigOddWeightInfo::setByID(int id) noexcept(false) { + this->checkConnection(); + + DateHandler dh(m_env, m_conn); + + try { + Statement* stmt = m_conn->createStatement(); + + stmt->setSQL("SELECT wei2_conf_id, tag, number_of_groups, db_timestamp FROM " + getTable() + + " WHERE wei2_conf_id = :1"); + stmt->setInt(1, id); + + ResultSet* rset = stmt->executeQuery(); + if (rset->next()) { + this->setId(rset->getInt(1)); + this->setConfigTag(rset->getString(2)); + this->setNumberOfGroups(rset->getInt(3)); + Date dbdate = rset->getDate(4); + this->setDBTime(dh.dateToTm(dbdate)); + } else { + throw(std::runtime_error("FEConfigOddWeightInfo::setByID: Given config_id is not in the database")); + } + + m_conn->terminateStatement(stmt); + } catch (SQLException& e) { + throw(std::runtime_error(std::string("FEConfigOddWeightInfo::setByID: ") + e.getMessage())); + } +} diff --git a/OnlineDB/EcalCondDB/src/FEConfigOddWeightModeDat.cc b/OnlineDB/EcalCondDB/src/FEConfigOddWeightModeDat.cc new file mode 100644 index 0000000000000..5f3f8c32fbe53 --- /dev/null +++ b/OnlineDB/EcalCondDB/src/FEConfigOddWeightModeDat.cc @@ -0,0 +1,168 @@ +#include +#include +#include "OnlineDB/Oracle/interface/Oracle.h" + +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightModeDat.h" +#include "OnlineDB/EcalCondDB/interface/FEConfigOddWeightInfo.h" + +using namespace std; +using namespace oracle::occi; + +FEConfigOddWeightModeDat::FEConfigOddWeightModeDat() { + m_env = nullptr; + m_conn = nullptr; + m_writeStmt = nullptr; + m_readStmt = nullptr; + + m_en_EB_flt = 0; + m_en_EE_flt = 0; + m_en_EB_pf = 0; + m_en_EE_pf = 0; + m_dis_EB_even_pf = 0; + m_dis_EE_even_pf = 0; + m_fe_EB_strout = 0; + m_fe_EE_strout = 0; + m_fe_EB_strib2 = 0; + m_fe_EE_strib2 = 0; + m_fe_EB_tcpout = 0; + m_fe_EB_tcpib1 = 0; + m_fe_EE_tcpout = 0; + m_fe_EE_tcpib1 = 0; + m_fe_par15 = 0; + m_fe_par16 = 0; + m_fe_par17 = 0; + m_fe_par18 = 0; +} + +FEConfigOddWeightModeDat::~FEConfigOddWeightModeDat() {} + +void FEConfigOddWeightModeDat::prepareWrite() noexcept(false) { + this->checkConnection(); + + try { + m_writeStmt = m_conn->createStatement(); + m_writeStmt->setSQL( + "INSERT INTO " + getTable() + + " (wei2_conf_id, " + " enableEBOddFilter, enableEEOddFilter, enableEBOddPeakFinder,enableEEOddPeakFinder, disableEBEvenPeakFinder, " + "DISABLEEEEVENPEAKFINDER, fenixEBStripOutput, fenixEEStripOutput, FenixEBStripInfoBit2, fenixEEStripInfobit2, " + "EBfenixTcpOutput, EBfenixTCPInfobit1,EEFENIXTCPOUTPUT, EEFENIXTCPINFOBIT1 ,fenixpar15, fenixpar16, " + "fenixpar17, fenixpar18 ) " + "VALUES (:wei2_conf_id, " + " :w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15 , :w16, :w17, :w18 )"); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightModeDat::prepareWrite(): " + e.getMessage())); + } +} + +void FEConfigOddWeightModeDat::writeDB(const EcalLogicID* ecid, + const FEConfigOddWeightModeDat* item, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + this->checkPrepare(); + + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightModeDat::writeDB: ICONF not in DB")); + } + + try { + m_writeStmt->setInt(1, iconfID); + + m_writeStmt->setInt(2, item->getFenixPar1()); + m_writeStmt->setInt(3, item->getFenixPar2()); + m_writeStmt->setInt(4, item->getFenixPar3()); + m_writeStmt->setInt(5, item->getFenixPar4()); + m_writeStmt->setInt(6, item->getFenixPar5()); + m_writeStmt->setInt(7, item->getFenixPar6()); + m_writeStmt->setInt(8, item->getFenixPar7()); + m_writeStmt->setInt(9, item->getFenixPar8()); + m_writeStmt->setInt(10, item->getFenixPar9()); + m_writeStmt->setInt(11, item->getFenixPar10()); + m_writeStmt->setInt(12, item->getFenixPar11()); + m_writeStmt->setInt(13, item->getFenixPar12()); + m_writeStmt->setInt(14, item->getFenixPar13()); + m_writeStmt->setInt(15, item->getFenixPar14()); + m_writeStmt->setInt(16, item->getFenixPar15()); + m_writeStmt->setInt(17, item->getFenixPar16()); + m_writeStmt->setInt(18, item->getFenixPar17()); + m_writeStmt->setInt(19, item->getFenixPar18()); + + m_writeStmt->executeUpdate(); + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightModeDat::writeDB(): " + e.getMessage())); + } +} + +void FEConfigOddWeightModeDat::fetchData(map* fillMap, + FEConfigOddWeightInfo* iconf) noexcept(false) { + this->checkConnection(); + fillMap->clear(); + + iconf->setConnection(m_env, m_conn); + int iconfID = iconf->fetchID(); + if (!iconfID) { + throw(std::runtime_error("FEConfigOddWeightModeDat::fetchData: ICONF not in DB")); + return; + } + + try { + m_readStmt->setSQL( + "SELECT enableEBOddFilter, enableEEOddFilter, enableEBOddPeakFinder,enableEEOddPeakFinder, " + "disableEBEvenPeakFinder, DISABLEEEEVENPEAKFINDER, fenixEBStripOutput, fenixEBStripOutput, " + "FenixEBStripInfoBit2, fenixEEStripInfobit2, EBfenixTcpOutput, EBfenixTCPInfobit1,EEFENIXTCPOUTPUT, " + "EEFENIXTCPINFOBIT1 ,fenixpar15, fenixpar16, fenixpar17, fenixpar18 " + "FROM " + + getTable() + + " d " + "WHERE wei2_conf_id = :wei2_conf_id "); + m_readStmt->setInt(1, iconfID); + ResultSet* rset = m_readStmt->executeQuery(); + + std::pair p; + FEConfigOddWeightModeDat dat; + int ig = -1; + while (rset->next()) { + ig++; // we create a dummy logic_id + p.first = EcalLogicID("Group_id", // name + ig); // logic_id + + dat.setFenixPar1(rset->getInt(1)); + dat.setFenixPar2(rset->getInt(2)); + dat.setFenixPar3(rset->getInt(3)); + dat.setFenixPar4(rset->getInt(4)); + dat.setFenixPar5(rset->getInt(5)); + dat.setFenixPar6(rset->getInt(6)); + dat.setFenixPar7(rset->getInt(7)); + dat.setFenixPar8(rset->getInt(8)); + dat.setFenixPar9(rset->getInt(9)); + dat.setFenixPar10(rset->getInt(10)); + dat.setFenixPar11(rset->getInt(11)); + dat.setFenixPar12(rset->getInt(12)); + dat.setFenixPar13(rset->getInt(13)); + dat.setFenixPar14(rset->getInt(14)); + dat.setFenixPar15(rset->getInt(15)); + dat.setFenixPar16(rset->getInt(16)); + dat.setFenixPar17(rset->getInt(17)); + dat.setFenixPar18(rset->getInt(18)); + + p.second = dat; + fillMap->insert(p); + } + } catch (SQLException& e) { + throw(std::runtime_error("FEConfigOddWeightModeDat::fetchData: " + e.getMessage())); + } +} + +void FEConfigOddWeightModeDat::writeArrayDB(const std::map* data, + FEConfigOddWeightInfo* iconf) noexcept(false) { + const EcalLogicID* channel; + const FEConfigOddWeightModeDat* dataitem; + + typedef map::const_iterator CI; + for (CI p = data->begin(); p != data->end(); ++p) { + channel = &(p->first); + dataitem = &(p->second); + writeDB(channel, dataitem, iconf); + } +} diff --git a/OnlineDB/EcalCondDB/test/BuildFile.xml b/OnlineDB/EcalCondDB/test/BuildFile.xml index 432ea142dbace..1b56dc353b263 100644 --- a/OnlineDB/EcalCondDB/test/BuildFile.xml +++ b/OnlineDB/EcalCondDB/test/BuildFile.xml @@ -1,6 +1,16 @@ + + + + + + + + + + diff --git a/OnlineDB/EcalCondDB/test/TestFEConfig2.cpp b/OnlineDB/EcalCondDB/test/TestFEConfig2.cpp new file mode 100644 index 0000000000000..baa17c230dc95 --- /dev/null +++ b/OnlineDB/EcalCondDB/test/TestFEConfig2.cpp @@ -0,0 +1,298 @@ +#include +#include +#include +#include +#include +#include + +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/EcalCondDB/interface/all_fe_config_types.h" +#include "OnlineDB/EcalCondDB/interface/RunDat.h" +#include "OnlineDB/EcalCondDB/interface/RunList.h" +#include "OnlineDB/EcalCondDB/interface/MonPedestalsDat.h" +#include "TROOT.h" +#include "TFile.h" +#include "TDirectory.h" +#include "TH2F.h" +#include "TF1.h" + +using namespace std; + +class CondDBApp { +public: + /** + * App constructor; Makes the database connection + */ + CondDBApp(string host, string sid, string user, string pass, int port) { + try { + cout << "Making connection...to " << port << flush; + econn = new EcalCondDBInterface(host, sid, user, pass, port); + cout << "Done." << endl; + } catch (runtime_error& e) { + cerr << e.what() << endl; + exit(-1); + } + } + CondDBApp(string sid, string user, string pass) { + try { + cout << "Making connection...to " << sid << endl; + econn = new EcalCondDBInterface(sid, user, pass); + cout << "Done." << endl; + } catch (runtime_error& e) { + cerr << e.what() << endl; + exit(-1); + } + } + + /** + * App destructor; Cleans up database connection + */ + ~CondDBApp() { delete econn; } + + inline std::string to_string(char value[]) { + std::ostringstream streamOut; + streamOut << value; + return streamOut.str(); + } + + void testReadOddWeights(int iconf_req) { + // now we do something else + // this is an example for reading the odd weights + // for a given config iconf_req + + cout << "*****************************************" << endl; + cout << "test reading odd weights with id=" << iconf_req << endl; + cout << "*****************************************" << endl; + + FEConfigOddWeightInfo fe_wei_info; + fe_wei_info.setId(iconf_req); + econn->fetchConfigSet(&fe_wei_info); + + map dataset_wei; + econn->fetchDataSet(&dataset_wei, &fe_wei_info); + + typedef map::const_iterator CIfewei; + EcalLogicID ecid_xt; + FEConfigOddWeightDat rd_wei; + + int rd_weiv[15176]; + for (int i = 0; i < 15176; i++) { + rd_weiv[i] = 0; + } + int i = 0; + for (CIfewei p = dataset_wei.begin(); p != dataset_wei.end(); p++) { + ecid_xt = p->first; + rd_wei = p->second; + int sm_num = ecid_xt.getID1(); + int tow_num = ecid_xt.getID2(); + int strip_num = ecid_xt.getID3(); + rd_weiv[i] = rd_wei.getWeightGroupId(); + if (i < 10) + std::cout << "here is the value for SM:" << sm_num << " tower:" << tow_num << " strip:" << strip_num + << " group id:" << rd_weiv[i] << endl; + i = i + 1; + } + + map dataset_mode; + econn->fetchDataSet(&dataset_mode, &fe_wei_info); + + typedef map::const_iterator CIfem; + FEConfigOddWeightModeDat rd_mode; + + int rd_modev[19] = {0}; + int k = 0; + for (CIfem p = dataset_mode.begin(); p != dataset_mode.end(); p++) { + rd_mode = p->second; + rd_modev[0] = rd_mode.getEnableEBOddFilter(); + rd_modev[1] = rd_mode.getEnableEEOddFilter(); + // ... + std::cout << "here is the value for the weight mode: EnableEBOddFilter:" << rd_modev[0] + << " EnableEEOddFilter:" << rd_modev[1] << std::endl; + k = k + 1; + } + + cout << "*****************************************" << endl; + cout << "test read done" << iconf_req << endl; + cout << "*****************************************" << endl; + } + + void testWriteOddWeights() { + // now we do something else + // this is an example for writing the odd weights + + cout << "*****************************************" << endl; + cout << "************Inserting Odd weights************" << endl; + cout << "*****************************************" << endl; + + FEConfigOddWeightInfo fe_wei_info; + fe_wei_info.setNumberOfGroups(2); // this eventually refers to some other table + fe_wei_info.setConfigTag("my preferred odd weights"); + econn->insertConfigSet(&fe_wei_info); + + Tm tdb = fe_wei_info.getDBTime(); + // tdb.dumpTm(); + + vector ecid_vec; + ecid_vec = econn->getEcalLogicIDSet("EB_VFE", 1, 36, 1, 68, 1, 5); + + map dataset; + // we create 2 groups + for (int ich = 0; ich < 2; ich++) { + FEConfigOddWeightGroupDat wei; + wei.setWeightGroupId(ich); + if (ich == 0) { // first group + wei.setWeight0(0); + wei.setWeight1(1); + wei.setWeight2(2); + wei.setWeight3(3); + wei.setWeight4(4); + wei.setWeight5(5); + } else { // second group + wei.setWeight0(2); + wei.setWeight1(3); + wei.setWeight2(4); + wei.setWeight3(5); + wei.setWeight4(6); + wei.setWeight5(7); + } + // Fill the dataset + dataset[ecid_vec[ich]] = wei; // we use any logic id, because it is in any case ignored... + } + + // Insert the dataset + econn->insertDataArraySet(&dataset, &fe_wei_info); + + vector my_StripEcalLogicId1_EE; + vector my_StripEcalLogicId2_EE; + + // EE Strip identifiers + // DCC=601-609 TT = ~40 EEstrip = 5 + my_StripEcalLogicId1_EE = + econn->getEcalLogicIDSetOrdered("ECAL_readout_strip", 601, 609, 1, 100, 0, 5, "ECAL_readout_strip", 123); + // EE Strip identifiers + // DCC=646-654 TT = ~40 EEstrip = 5 + my_StripEcalLogicId2_EE = + econn->getEcalLogicIDSetOrdered("ECAL_readout_strip", 646, 654, 1, 100, 0, 5, "ECAL_readout_strip", 123); + + // now we store in the DB the correspondence btw channels and odd weight groups + map dataset2; + // in this case I decide in a stupid way which channel belongs to which group + for (int ich = 0; ich < (int)ecid_vec.size(); ich++) { + FEConfigOddWeightDat weid; + if (ecid_vec[ich].getID1() <= 609 || ecid_vec[ich].getID1() > 645) { + weid.setWeightGroupId(0); // EB + } + // Fill the dataset + dataset2[ecid_vec[ich]] = weid; + } + + // EE loop + for (int ich = 0; ich < (int)my_StripEcalLogicId1_EE.size(); ich++) { + FEConfigOddWeightDat wut; + int igroup = 1; // this group is for EE + wut.setWeightGroupId(igroup); + // Fill the dataset + dataset2[my_StripEcalLogicId1_EE[ich]] = wut; + } + // EE loop 2 (we had to split the ids of EE in 2 vectors to avoid crash!) + for (int ich = 0; ich < (int)my_StripEcalLogicId2_EE.size(); ich++) { + FEConfigOddWeightDat wut; + int igroup = 1; // this group is for EE + wut.setWeightGroupId(igroup); + // Fill the dataset + dataset2[my_StripEcalLogicId2_EE[ich]] = wut; + } + + // Insert the dataset + + econn->insertDataArraySet(&dataset2, &fe_wei_info); + + map datasetmode; + FEConfigOddWeightModeDat wei_mode; + wei_mode.setEnableEBOddFilter(3); + wei_mode.setDisableEBEvenPeakFinder(4); + wei_mode.setFenixEEStripOutput(5); + // this is just a test, I leave the other parameters at 0 + + // Fill the dataset + datasetmode[ecid_vec[0]] = wei_mode; // we use any logic id, because it is in any case ignored... + + econn->insertDataSet(&datasetmode, &fe_wei_info); + + cout << "*****************************************" << endl; + cout << "*********** odd weights done ************" << endl; + cout << "*****************************************" << endl; + } + +private: + CondDBApp(); // hidden default constructor + EcalCondDBInterface* econn; + + uint64_t startmicros; + uint64_t endmicros; + run_t startrun; + run_t endrun; + + TFile* f; + TH2F* mataq_vs_run; + TH2F* apd_pn_mean_vs_run; + + void printTag(const RunTag* tag) const { + cout << endl; + cout << "=============RunTag:" << endl; + cout << "GeneralTag: " << tag->getGeneralTag() << endl; + cout << "Location: " << tag->getLocationDef().getLocation() << endl; + cout << "Run Type: " << tag->getRunTypeDef().getRunType() << endl; + cout << "====================" << endl; + } + + void printIOV(const RunIOV* iov) const { + cout << endl; + cout << "=============RunIOV:" << endl; + RunTag tag = iov->getRunTag(); + printTag(&tag); + cout << "Run Number: " << iov->getRunNumber() << endl; + cout << "Run Start: " << iov->getRunStart().str() << endl; + cout << "Run End: " << iov->getRunEnd().str() << endl; + cout << "====================" << endl; + } +}; + +int main(int argc, char* argv[]) { + string sid; + string user; + string pass; + string cfg_str; + string read_and_w_str; + + if (argc != 6) { + cout << "Usage:" << endl; + cout << " " << argv[0] << " " << endl; + exit(-1); + } + + sid = argv[1]; + user = argv[2]; + pass = argv[3]; + cfg_str = argv[4]; + int cfg_id = atoi(cfg_str.c_str()); + read_and_w_str = argv[5]; + int rw_id = atoi(read_and_w_str.c_str()); + + try { + CondDBApp app(sid, user, pass); + if (rw_id == 1 || rw_id == 2) + app.testWriteOddWeights(); + if (rw_id == 0 || rw_id == 2) + app.testReadOddWeights(cfg_id); + } catch (exception& e) { + cout << "ERROR: " << e.what() << endl; + } catch (...) { + cout << "Unknown error caught" << endl; + } + + cout << "All Done." << endl; + + return 0; +} diff --git a/OnlineDB/EcalCondDB/test/TestOddWeightConf_v1.cpp b/OnlineDB/EcalCondDB/test/TestOddWeightConf_v1.cpp new file mode 100644 index 0000000000000..5e77d09c3d8c1 --- /dev/null +++ b/OnlineDB/EcalCondDB/test/TestOddWeightConf_v1.cpp @@ -0,0 +1,329 @@ +#include +#include +#include +#include +#include +#include + +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/EcalCondDB/interface/all_fe_config_types.h" +#include "OnlineDB/EcalCondDB/interface/RunDat.h" +#include "OnlineDB/EcalCondDB/interface/RunList.h" +#include "OnlineDB/EcalCondDB/interface/MonPedestalsDat.h" +#include "TROOT.h" +#include "TFile.h" +#include "TDirectory.h" +#include "TH2F.h" +#include "TF1.h" + +using namespace std; + +class CondDBApp { +public: + /** + * App constructor; Makes the database connection + */ + CondDBApp(string host, string sid, string user, string pass, int port) { + try { + cout << "Making connection...to " << port << flush; + econn = new EcalCondDBInterface(host, sid, user, pass, port); + cout << "Done." << endl; + } catch (runtime_error& e) { + cerr << e.what() << endl; + exit(-1); + } + } + CondDBApp(string sid, string user, string pass) { + try { + cout << "Making connection...to " << sid << endl; + econn = new EcalCondDBInterface(sid, user, pass); + cout << "Done." << endl; + } catch (runtime_error& e) { + cerr << e.what() << endl; + exit(-1); + } + } + + /** + * App destructor; Cleans up database connection + */ + ~CondDBApp() { delete econn; } + + inline std::string to_string(char value[]) { + std::ostringstream streamOut; + streamOut << value; + return streamOut.str(); + } + + void testReadOddWeights(int iconf_req) { + // now we do something else + // this is an example for reading the odd weights + // for a given config iconf_req + + cout << "*****************************************" << endl; + cout << "test reading odd weights with id=" << iconf_req << endl; + cout << "*****************************************" << endl; + + FEConfigOddWeightInfo fe_wei_info; + fe_wei_info.setId(iconf_req); + econn->fetchConfigSet(&fe_wei_info); + + map dataset_wei; + econn->fetchDataSet(&dataset_wei, &fe_wei_info); + + typedef map::const_iterator CIfewei; + EcalLogicID ecid_xt; + FEConfigOddWeightDat rd_wei; + + int rd_weiv[15176]; + for (int i = 0; i < 15176; i++) { + rd_weiv[i] = 0; + } + int i = 0; + for (CIfewei p = dataset_wei.begin(); p != dataset_wei.end(); p++) { + ecid_xt = p->first; + rd_wei = p->second; + int sm_num = ecid_xt.getID1(); + int tow_num = ecid_xt.getID2(); + int strip_num = ecid_xt.getID3(); + rd_weiv[i] = rd_wei.getWeightGroupId(); + if (i < 10) + std::cout << "here is the value for SM:" << sm_num << " tower:" << tow_num << " strip:" << strip_num + << " group id:" << rd_weiv[i] << endl; + i = i + 1; + } + + map dataset_mode; + econn->fetchDataSet(&dataset_mode, &fe_wei_info); + + typedef map::const_iterator CIfem; + FEConfigOddWeightModeDat rd_mode; + + int rd_modev[19] = {0}; + int k = 0; + for (CIfem p = dataset_mode.begin(); p != dataset_mode.end(); p++) { + rd_mode = p->second; + rd_modev[0] = rd_mode.getEnableEBOddFilter(); + rd_modev[1] = rd_mode.getEnableEEOddFilter(); + rd_modev[2] = rd_mode.getEnableEBOddPeakFinder(); + rd_modev[3] = rd_mode.getEnableEEOddPeakFinder(); + rd_modev[4] = rd_mode.getDisableEBEvenPeakFinder(); + rd_modev[5] = rd_mode.getDisableEEEvenPeakFinder(); + rd_modev[6] = rd_mode.getFenixEBStripOutput(); + rd_modev[7] = rd_mode.getFenixEEStripOutput(); + rd_modev[8] = rd_mode.getFenixEBStripInfobit2(); + rd_modev[9] = rd_mode.getFenixEEStripInfobit2(); + rd_modev[10] = rd_mode.getFenixEBTcpOutput(); + rd_modev[11] = rd_mode.getFenixEBTcpInfobit1(); + rd_modev[12] = rd_mode.getFenixEETcpOutput(); + rd_modev[13] = rd_mode.getFenixEETcpInfobit1(); + // ... + std::cout << "here is the value for the weight mode: " << std::endl + << " EnableEBOddFilter:" << rd_modev[0] << std::endl + << " EnableEEOddFilter:" << rd_modev[1] << std::endl + << " EnableEBOddPeakFinder:" << rd_modev[2] << std::endl + << " EnableEEOddPeakFinder:" << rd_modev[3] << std::endl + << " DisableEBEvenPeakFinder:" << rd_modev[4] << std::endl + << " DisableEEEvenPeakFinder:" << rd_modev[5] << std::endl + << " FenixEBStripOutput:" << rd_modev[6] << std::endl + << " FenixEEStripOutput:" << rd_modev[7] << std::endl + << " FenixEBStripInfobit2:" << rd_modev[8] << std::endl + << " FenixEEStripInfobit2:" << rd_modev[9] << std::endl + << " FenixEBTcpOutput:" << rd_modev[10] << std::endl + << " FenixEBTcpinfobit1:" << rd_modev[11] << std::endl + << " FenixEETcpOutput:" << rd_modev[12] << std::endl + << " FenixEETcpinfobit1:" << rd_modev[13] << std::endl; + k = k + 1; + } + + cout << "*****************************************" << endl; + cout << "test read done" << iconf_req << endl; + cout << "*****************************************" << endl; + } + + void testWriteOddWeights() { + // now we do something else + // this is an example for writing the odd weights + + cout << "*****************************************" << endl; + cout << "************Inserting Odd weights************" << endl; + cout << "*****************************************" << endl; + + FEConfigOddWeightInfo fe_wei_info; + fe_wei_info.setNumberOfGroups(2); // this eventually refers to some other table + fe_wei_info.setConfigTag("oddweights_zeroing_flagging_test_v1"); + econn->insertConfigSet(&fe_wei_info); + + Tm tdb = fe_wei_info.getDBTime(); + // tdb.dumpTm(); + + vector EB_ecid_vec, EE_ecid_vec1, EE_ecid_vec2; + EB_ecid_vec = econn->getEcalLogicIDSet("EB_VFE", 1, 36, 1, 68, 1, 5); + + // EE Strip identifiers + // DCC=601-609 TT = ~40 EEstrip = 5 + EE_ecid_vec1 = + econn->getEcalLogicIDSetOrdered("ECAL_readout_strip", 601, 609, 1, 100, 0, 5, "ECAL_readout_strip", 123); + // EE Strip identifiers + // DCC=646-654 TT = ~40 EEstrip = 5 + EE_ecid_vec2 = + econn->getEcalLogicIDSetOrdered("ECAL_readout_strip", 646, 654, 1, 100, 0, 5, "ECAL_readout_strip", 123); + + map dataset; + // All EB with the same weights, and all EE with slightly different + for (int ich = 0; ich < 2; ich++) { + FEConfigOddWeightGroupDat wei; + wei.setWeightGroupId(ich); + if (ich == 0) { // first group + wei.setWeight0(125); // w0 in the confDB is w4 in the offline 125,63,0,0,68 + wei.setWeight1(63 + 0x80); + wei.setWeight2(0); + wei.setWeight3(0); + wei.setWeight4(68); + wei.setWeight5(0); + } else { // second group + wei.setWeight0(125); // w0 in the confDB is w4 in the offline 125,63,0,0,68 + wei.setWeight1(64 + 0x80); + wei.setWeight2(0); + wei.setWeight3(0); + wei.setWeight4(67); + wei.setWeight5(0); + } + // Fill the dataset + dataset[EB_ecid_vec[ich]] = wei; // we use any logic id, because it is in any case ignored... + } + + // Insert the dataset + econn->insertDataArraySet(&dataset, &fe_wei_info); + + // now we store in the DB the correspondence btw channels and odd weight groups + map dataset2; + // in this case I decide in a stupid way which channel belongs to which group + for (int ich = 0; ich < (int)EB_ecid_vec.size(); ich++) { + FEConfigOddWeightDat weid; + std::cout << "EB " << EB_ecid_vec[ich].getID1() << " " << EB_ecid_vec[ich].getID2() << " " + << EB_ecid_vec[ich].getID3() << std::endl; + weid.setWeightGroupId(0); // EB + // Fill the dataset + dataset2[EB_ecid_vec[ich]] = weid; + } + + for (int ich = 0; ich < (int)EE_ecid_vec1.size(); ich++) { + FEConfigOddWeightDat weid; + weid.setWeightGroupId(1); + // Fill the dataset + std::cout << "EE " << EE_ecid_vec1[ich].getID1() << " " << EE_ecid_vec1[ich].getID2() << " " + << EE_ecid_vec1[ich].getID3() << std::endl; + dataset2[EE_ecid_vec1[ich]] = weid; + } + // EE loop 2 (we had to split the ids of EE in 2 vectors to avoid crash!) + for (int ich = 0; ich < (int)EE_ecid_vec2.size(); ich++) { + FEConfigOddWeightDat weid; + std::cout << "EE " << EE_ecid_vec2[ich].getID1() << " " << EE_ecid_vec2[ich].getID2() << " " + << EE_ecid_vec2[ich].getID3() << std::endl; + weid.setWeightGroupId(1); + // Fill the dataset + dataset2[EE_ecid_vec2[ich]] = weid; + } + + // Insert the dataset + + econn->insertDataArraySet(&dataset2, &fe_wei_info); + + map datasetmode; + FEConfigOddWeightModeDat wei_mode; + + wei_mode.setEnableEBOddFilter(1); + wei_mode.setEnableEEOddFilter(1); + wei_mode.setEnableEBOddPeakFinder(1); + wei_mode.setEnableEEOddPeakFinder(1); + + wei_mode.setFenixEBStripOutput(2); + wei_mode.setFenixEEStripOutput(2); + + wei_mode.setFenixEBStripInfobit2(1); + wei_mode.setFenixEBTcpOutput(2); + wei_mode.setFenixEBTcpInfoBit1(1); + + // Fill the dataset + datasetmode[EB_ecid_vec[0]] = wei_mode; // we use any logic id, because it is in any case ignored... + + econn->insertDataSet(&datasetmode, &fe_wei_info); + + cout << "*****************************************" << endl; + cout << "*********** odd weights done ************" << endl; + cout << "*****************************************" << endl; + } + +private: + CondDBApp(); // hidden default constructor + EcalCondDBInterface* econn; + + uint64_t startmicros; + uint64_t endmicros; + run_t startrun; + run_t endrun; + + TFile* f; + TH2F* mataq_vs_run; + TH2F* apd_pn_mean_vs_run; + + void printTag(const RunTag* tag) const { + cout << endl; + cout << "=============RunTag:" << endl; + cout << "GeneralTag: " << tag->getGeneralTag() << endl; + cout << "Location: " << tag->getLocationDef().getLocation() << endl; + cout << "Run Type: " << tag->getRunTypeDef().getRunType() << endl; + cout << "====================" << endl; + } + + void printIOV(const RunIOV* iov) const { + cout << endl; + cout << "=============RunIOV:" << endl; + RunTag tag = iov->getRunTag(); + printTag(&tag); + cout << "Run Number: " << iov->getRunNumber() << endl; + cout << "Run Start: " << iov->getRunStart().str() << endl; + cout << "Run End: " << iov->getRunEnd().str() << endl; + cout << "====================" << endl; + } +}; + +int main(int argc, char* argv[]) { + string sid; + string user; + string pass; + string cfg_str; + string read_and_w_str; + + if (argc != 6) { + cout << "Usage:" << endl; + cout << " " << argv[0] << " " << endl; + exit(-1); + } + + sid = argv[1]; + user = argv[2]; + pass = argv[3]; + cfg_str = argv[4]; + int cfg_id = atoi(cfg_str.c_str()); + read_and_w_str = argv[5]; + int rw_id = atoi(read_and_w_str.c_str()); + + try { + CondDBApp app(sid, user, pass); + if (rw_id == 1 || rw_id == 2) + app.testWriteOddWeights(); + if (rw_id == 0 || rw_id == 2) + app.testReadOddWeights(cfg_id); + } catch (exception& e) { + cout << "ERROR: " << e.what() << endl; + } catch (...) { + cout << "Unknown error caught" << endl; + } + + cout << "All Done." << endl; + + return 0; +} diff --git a/PhysicsTools/PatAlgos/python/patMuonMerger_cfi.py b/PhysicsTools/PatAlgos/python/patMuonMerger_cfi.py index a49456feb7a68..8406f5a6f3417 100644 --- a/PhysicsTools/PatAlgos/python/patMuonMerger_cfi.py +++ b/PhysicsTools/PatAlgos/python/patMuonMerger_cfi.py @@ -1,10 +1,7 @@ import FWCore.ParameterSet.Config as cms - -mergedMuons = cms.EDProducer("PATMuonMerger", - muons = cms.InputTag("slimmedMuons"), - pfCandidates=cms.InputTag("packedPFCandidates"), - otherTracks = cms.InputTag("lostTracks"), - muonCut = cms.string("pt>15 && abs(eta)<2.4"), - pfCandidatesCut = cms.string("pt>15 && abs(eta)<2.4"), - lostTrackCut = cms.string("pt>15 && abs(eta)<2.4") +import PhysicsTools.PatAlgos.mergedMuonsNoCuts_cfi as _mod +mergedMuons = _mod.mergedMuonsNoCuts.clone( + muonCut = "pt>15 && abs(eta)<2.4", + pfCandidatesCut = "pt>15 && abs(eta)<2.4", + lostTrackCut = "pt>15 && abs(eta)<2.4" ) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 827ad0bd38813..8b04ba50a66f9 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -618,9 +618,9 @@ def miniAOD_customizeData(process): process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi") process.load('L1Trigger.L1TGlobal.simGtExtFakeProd_cfi') task = getPatAlgosToolsTask(process) - from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 - ctpps_2016.toModify(task, func=lambda t: t.add(process.ctppsLocalTrackLiteProducer)) - ctpps_2016.toModify(task, func=lambda t: t.add(process.ctppsProtons)) + from Configuration.Eras.Modifier_ctpps_cff import ctpps + ctpps.toModify(task, func=lambda t: t.add(process.ctppsLocalTrackLiteProducer)) + ctpps.toModify(task, func=lambda t: t.add(process.ctppsProtons)) from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL run2_miniAOD_UL.toModify(task, func=lambda t: t.add(process.simGtExtUnprefireable)) diff --git a/PhysicsTools/PatUtils/python/tools/muonRecoMitigation.py b/PhysicsTools/PatUtils/python/tools/muonRecoMitigation.py index bcfd6bdfd1183..1694f7762c780 100644 --- a/PhysicsTools/PatUtils/python/tools/muonRecoMitigation.py +++ b/PhysicsTools/PatUtils/python/tools/muonRecoMitigation.py @@ -62,11 +62,13 @@ def muonRecoMitigation(process, # now cleaning ================================ cleanedPFCandCollection=cleanCollName+postfix + if runOnMiniAOD: - cleanedPFCandProducer = cms.EDProducer("CandPtrProjector", - src = cms.InputTag(pfCandCollection), - veto = cms.InputTag(badMuonCollection) - ) + import CommonTools.CandAlgos.candPtrProjector_cfi as _mod + cleanedPFCandProducer = _mod.candPtrProjector.clone( + src = pfCandCollection, + veto = badMuonCollection + ) else: cleanedPFCandProducer = cms.EDProducer("PFCandPtrProjector", src = cms.InputTag(pfCandCollection), diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index c8dad033f2f64..d13d19055248d 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -5,6 +5,7 @@ import PhysicsTools.PatAlgos.tools.helpers as configtools from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask from PhysicsTools.PatAlgos.tools.jetTools import switchJetCollection +import CommonTools.CandAlgos.candPtrProjector_cfi as _mod def isValidInputTag(input): @@ -833,17 +834,17 @@ def getMETUncertainties(self, process, metType, metModName, electronCollection, if not hasattr(process, "pfCandsForUnclusteredUnc"+postfix): #Jet projection == - pfCandsNoJets = cms.EDProducer("CandPtrProjector", + pfCandsNoJets = _mod.candPtrProjector.clone( src = pfCandCollection, - veto = copy.copy(jetCollection), + veto = jetCollection, ) addToProcessAndTask("pfCandsNoJets"+postfix, pfCandsNoJets, process, task) metUncSequence += getattr(process, "pfCandsNoJets"+postfix) #electron projection == - pfCandsNoJetsNoEle = cms.EDProducer("CandPtrProjector", - src = cms.InputTag("pfCandsNoJets"+postfix), - veto = copy.copy(electronCollection), + pfCandsNoJetsNoEle = _mod.candPtrProjector.clone( + src = "pfCandsNoJets"+postfix, + veto = electronCollection, ) if not self.getvalue("onMiniAOD"): pfCandsNoJetsNoEle.veto = "pfeGammaToCandidate:electrons" @@ -851,25 +852,25 @@ def getMETUncertainties(self, process, metType, metModName, electronCollection, metUncSequence += getattr(process, "pfCandsNoJetsNoEle"+postfix) #muon projection == - pfCandsNoJetsNoEleNoMu = cms.EDProducer("CandPtrProjector", - src = cms.InputTag("pfCandsNoJetsNoEle"+postfix), - veto = copy.copy(muonCollection), + pfCandsNoJetsNoEleNoMu = _mod.candPtrProjector.clone( + src = "pfCandsNoJetsNoEle"+postfix, + veto = muonCollection, ) addToProcessAndTask("pfCandsNoJetsNoEleNoMu"+postfix, pfCandsNoJetsNoEleNoMu, process, task) metUncSequence += getattr(process, "pfCandsNoJetsNoEleNoMu"+postfix) #tau projection == - pfCandsNoJetsNoEleNoMuNoTau = cms.EDProducer("CandPtrProjector", - src = cms.InputTag("pfCandsNoJetsNoEleNoMu"+postfix), - veto = copy.copy(tauCollection), + pfCandsNoJetsNoEleNoMuNoTau = _mod.candPtrProjector.clone( + src = "pfCandsNoJetsNoEleNoMu"+postfix, + veto = tauCollection, ) addToProcessAndTask("pfCandsNoJetsNoEleNoMuNoTau"+postfix, pfCandsNoJetsNoEleNoMuNoTau, process, task) metUncSequence += getattr(process, "pfCandsNoJetsNoEleNoMuNoTau"+postfix) #photon projection == - pfCandsForUnclusteredUnc = cms.EDProducer("CandPtrProjector", - src = cms.InputTag("pfCandsNoJetsNoEleNoMuNoTau"+postfix), - veto = copy.copy(photonCollection), + pfCandsForUnclusteredUnc = _mod.candPtrProjector.clone( + src = "pfCandsNoJetsNoEleNoMuNoTau"+postfix, + veto = photonCollection, ) if not self.getvalue("onMiniAOD"): pfCandsForUnclusteredUnc.veto = "pfeGammaToCandidate:photons" @@ -1350,9 +1351,9 @@ def getUnclusteredVariationsForMVAMET(self, process, var, val, metUncSequence, pfCandCollection = self._parameters["pfCandCollection"].value #top projection on jets - pfCandsNotInJets = cms.EDProducer("CandPtrProjector", + pfCandsNotInJets = _mod.candPtrProjector.clone( src = pfCandCollection, - veto = cms.InputTag("ak4PFJets") + veto = "ak4PFJets" ) setattr(process, "pfCandsNotInJetsUnclusteredEn"+var+postfix, pfCandsNotInJets) metUncSequence += getattr(process,"pfCandsNotInJetsUnclusteredEn"+var+postfix) @@ -1922,9 +1923,9 @@ def runFixEE2017(self,process,params,jets,cands,goodcolls,patMetModuleSequence,p ) addToProcessAndTask("pfcandidateClustered"+postfix, pfcandidateClustered, process, task) patMetModuleSequence += getattr(process,"pfcandidateClustered"+postfix) - pfcandidateForUnclusteredUnc = cms.EDProducer("CandPtrProjector", + pfcandidateForUnclusteredUnc = _mod.candPtrProjector.clone( src = cands, - veto = cms.InputTag("pfcandidateClustered"+postfix), + veto = "pfcandidateClustered"+postfix, ) addToProcessAndTask("pfcandidateForUnclusteredUnc"+postfix, pfcandidateForUnclusteredUnc, process, task) patMetModuleSequence += getattr(process,"pfcandidateForUnclusteredUnc"+postfix) @@ -1947,9 +1948,9 @@ def runFixEE2017(self,process,params,jets,cands,goodcolls,patMetModuleSequence,p ) addToProcessAndTask("superbad"+postfix, superbad, process, task) patMetModuleSequence += getattr(process,"superbad"+postfix) - pfCandidatesGoodEE2017 = cms.EDProducer("CandPtrProjector", + pfCandidatesGoodEE2017 = _mod.candPtrProjector.clone( src = cands, - veto = cms.InputTag("superbad"+postfix), + veto = "superbad"+postfix, ) addToProcessAndTask("pfCandidatesGoodEE2017"+postfix, pfCandidatesGoodEE2017, process, task) patMetModuleSequence += getattr(process,"pfCandidatesGoodEE2017"+postfix) diff --git a/PhysicsTools/PythonAnalysis/test/BuildFile.xml b/PhysicsTools/PythonAnalysis/test/BuildFile.xml index 3d3fcfd2894c6..0c88d4957d73e 100644 --- a/PhysicsTools/PythonAnalysis/test/BuildFile.xml +++ b/PhysicsTools/PythonAnalysis/test/BuildFile.xml @@ -28,134 +28,132 @@ - + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - diff --git a/PhysicsTools/UtilAlgos/test/fwliteWithPythonConfig_cfg.py b/PhysicsTools/UtilAlgos/test/fwliteWithPythonConfig_cfg.py index 714cf902f2597..abb3931bb1aa1 100644 --- a/PhysicsTools/UtilAlgos/test/fwliteWithPythonConfig_cfg.py +++ b/PhysicsTools/UtilAlgos/test/fwliteWithPythonConfig_cfg.py @@ -3,7 +3,7 @@ process = cms.PSet() process.fwliteInput = cms.PSet( - fileNames = cms.vstring('root://eoscms.cern.ch//eos/cms/store/relval/CMSSW_7_2_0_pre5/RelValProdTTbar/GEN-SIM-RECO/START72_V1-v1/00000/022350A9-AC30-E411-B225-0025905A6076.root'), ## mandatory + fileNames = cms.vstring('root://eoscms.cern.ch//eos/cms/store/user/cmsbuild/store/relval/CMSSW_9_3_0_pre1/RelValTTbar_13/GEN-SIM-RECO/PU25ns_92X_upgrade2017_realistic_v7-v1/00000/32EA1438-3D61-E711-8FE7-0025905B85B2.root'), ## mandatory maxEvents = cms.int32(100), ## optional outputEvery = cms.uint32(10), ## optional ) diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index 7e0076bb947bb..62ae794e85ecc 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -3,6 +3,7 @@ #AOD content TICL_AOD = cms.PSet( + # 13/04/2021 Felice: MultiClusters will be deprecated soon outputCommands = cms.untracked.vstring( 'keep *_ticlMultiClustersFromTrackstersEM_*_*', 'keep *_ticlMultiClustersFromTrackstersHAD_*_*', @@ -10,6 +11,7 @@ 'keep *_ticlMultiClustersFromTrackstersTrkEM_*_*', 'keep *_ticlMultiClustersFromTrackstersMIP_*_*', 'keep *_ticlMultiClustersFromTrackstersMerge_*_*', + 'keep *_ticlMultiClustersFromSimTracksters_*_*', ) ) @@ -35,6 +37,7 @@ # FEVT Content TICL_FEVT = cms.PSet( outputCommands = cms.untracked.vstring( + 'keep *_ticlSimTracksters_*_*', ) ) TICL_FEVT.outputCommands.extend(TICL_RECO.outputCommands) diff --git a/RecoHGCal/TICL/plugins/BuildFile.xml b/RecoHGCal/TICL/plugins/BuildFile.xml index 00c267848b23e..c3b923786d3f3 100644 --- a/RecoHGCal/TICL/plugins/BuildFile.xml +++ b/RecoHGCal/TICL/plugins/BuildFile.xml @@ -1,18 +1,36 @@ - - - - - - + + + - + + + + + - + + + + + + + + + + + + + + + + + + diff --git a/RecoHGCal/TICL/plugins/HGCDoublet.cc b/RecoHGCal/TICL/plugins/HGCDoublet.cc index cac2c4d1a52df..cec1229a6b8f0 100644 --- a/RecoHGCal/TICL/plugins/HGCDoublet.cc +++ b/RecoHGCal/TICL/plugins/HGCDoublet.cc @@ -110,9 +110,10 @@ int HGCDoublet::areAligned(double xi, auto minCosPointing_sq = minCosPointing * minCosPointing; bool isWithinLimitsPointing = (dot_pointing_sq > minCosPointing_sq * mag_pointing_sq * mag2sq); if (debug) { - LogDebug("HGCDoublet") << "-- Are Aligned -- dot_pointing_sq: " << dot_pointing * dot_pointing + LogDebug("HGCDoublet") << "Pointing direction: " << pointingDir << std::endl; + LogDebug("HGCDoublet") << "-- Are Aligned -- dot_pointing_sq: " << dot_pointing_sq << " mag_pointing_sq: " << mag_pointing_sq << " mag2sq: " << mag2sq - << " isWithinLimits: " << isWithinLimitsPointing << std::endl; + << " isWithinLimitsPointing: " << isWithinLimitsPointing << std::endl; } // by squaring cosTheta and multiplying by the squares of the magnitudes // an equivalent comparison is made without the division and square root which are costly FP ops. diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc new file mode 100644 index 0000000000000..3b0a75ee1a283 --- /dev/null +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -0,0 +1,151 @@ +// Author: Felice Pantaleo - felice.pantaleo@cern.ch +// Date: 02/2021 + +// user include files + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "DataFormats/CaloRecHit/interface/CaloCluster.h" +#include "DataFormats/ParticleFlowReco/interface/PFCluster.h" + +#include "DataFormats/HGCalReco/interface/Trackster.h" + +#include "DataFormats/Common/interface/ValueMap.h" +#include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +#include "TrackstersPCA.h" +#include +#include +#include +using namespace ticl; + +namespace { + Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge) { + if (pdgId == 111) { + return Trackster::ParticleType::neutral_pion; + } else { + pdgId = std::abs(pdgId); + if (pdgId == 22) { + return Trackster::ParticleType::photon; + } else if (pdgId == 11) { + return Trackster::ParticleType::electron; + } else if (pdgId == 13) { + return Trackster::ParticleType::muon; + } else { + bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000); + if (isHadron) { + if (charge != 0) { + return Trackster::ParticleType::charged_hadron; + } else { + return Trackster::ParticleType::neutral_hadron; + } + } else { + return Trackster::ParticleType::unknown; + } + } + } + } +} // namespace + +class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { +public: + explicit TrackstersFromSimClustersProducer(const edm::ParameterSet&); + ~TrackstersFromSimClustersProducer() override {} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + std::string detector_; + const bool doNose_ = false; + const edm::EDGetTokenT> clusters_token_; + const edm::EDGetTokenT>> clustersTime_token_; + const edm::EDGetTokenT> filtered_layerclusters_mask_token_; + + edm::EDGetTokenT> simclusters_token_; + + edm::InputTag associatorLayerClusterSimCluster_; + edm::EDGetTokenT associatorMapSimToReco_token_; + edm::ESGetToken geom_token_; + hgcal::RecHitTools rhtools_; +}; +DEFINE_FWK_MODULE(TrackstersFromSimClustersProducer); + +TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm::ParameterSet& ps) + : detector_(ps.getParameter("detector")), + doNose_(detector_ == "HFNose"), + clusters_token_(consumes>(ps.getParameter("layer_clusters"))), + clustersTime_token_( + consumes>>(ps.getParameter("time_layerclusters"))), + filtered_layerclusters_mask_token_(consumes>(ps.getParameter("filtered_mask"))), + simclusters_token_(consumes>(ps.getParameter("simclusters"))), + associatorLayerClusterSimCluster_(ps.getUntrackedParameter("layerClusterSimClusterAssociator")), + associatorMapSimToReco_token_( + consumes(associatorLayerClusterSimCluster_)), + geom_token_(esConsumes()) { + produces>(); + produces>(); +} + +void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // hgcalMultiClusters + edm::ParameterSetDescription desc; + desc.add("detector", "HGCAL"); + desc.add("layer_clusters", edm::InputTag("hgcalLayerClusters")); + desc.add("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster")); + desc.add("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters")); + desc.add("simclusters", edm::InputTag("mix", "MergedCaloTruth")); + desc.addUntracked("layerClusterSimClusterAssociator", + edm::InputTag("layerClusterSimClusterAssociationProducer")); + descriptions.add("trackstersFromSimClustersProducer", desc); +} + +void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::EventSetup& es) { + auto result = std::make_unique>(); + auto output_mask = std::make_unique>(); + const auto& layerClusters = evt.get(clusters_token_); + const auto& layerClustersTimes = evt.get(clustersTime_token_); + const auto& inputClusterMask = evt.get(filtered_layerclusters_mask_token_); + output_mask->resize(layerClusters.size(), 1.f); + + const auto& simclusters = evt.get(simclusters_token_); + const auto& simToRecoColl = evt.get(associatorMapSimToReco_token_); + + const auto& geom = es.getData(geom_token_); + rhtools_.setGeometry(geom); + auto num_simclusters = simclusters.size(); + result->reserve(num_simclusters); + for (const auto& [key, values] : simToRecoColl) { + auto const& sc = *(key); + auto simClusterIndex = &sc - &simclusters[0]; + Trackster tmpTrackster; + tmpTrackster.zeroProbabilities(); + tmpTrackster.vertices().reserve(values.size()); + tmpTrackster.vertex_multiplicity().reserve(values.size()); + + for (auto const& [lc, energyScorePair] : values) { + if (inputClusterMask[lc.index()] > 0) { + tmpTrackster.vertices().push_back(lc.index()); + double fraction = energyScorePair.first / lc->energy(); + (*output_mask)[lc.index()] -= fraction; + tmpTrackster.vertex_multiplicity().push_back(static_cast(std::clamp(1. / fraction, 0., 255.))); + } + } + tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); + tmpTrackster.setSeed(key.id(), simClusterIndex); + result->emplace_back(tmpTrackster); + } + ticl::assignPCAtoTracksters( + *result, layerClusters, layerClustersTimes, rhtools_.getPositionLayer(rhtools_.lastLayerEE(doNose_)).z()); + evt.put(std::move(result)); + evt.put(std::move(output_mask)); +} diff --git a/RecoHGCal/TICL/plugins/TrackstersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersProducer.cc index 14345ffedde9e..a24cc86f49aca 100644 --- a/RecoHGCal/TICL/plugins/TrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersProducer.cc @@ -102,9 +102,9 @@ TrackstersProducer::TrackstersProducer(const edm::ParameterSet& ps, const Tracks iterIndex_ = ticl::Trackster::TRKEM; else if (itername_ == "EM") iterIndex_ = ticl::Trackster::EM; - else if (itername_ == "TRK") + else if (itername_ == "Trk") iterIndex_ = ticl::Trackster::TRKHAD; - else if (itername_ == "HADRONIC") + else if (itername_ == "HAD") iterIndex_ = ticl::Trackster::HAD; else if (itername_ == "MIP") iterIndex_ = ticl::Trackster::MIP; diff --git a/RecoHGCal/TICL/python/HADStep_cff.py b/RecoHGCal/TICL/python/HADStep_cff.py index 9af07d2e4faf4..655fadae45f3a 100644 --- a/RecoHGCal/TICL/python/HADStep_cff.py +++ b/RecoHGCal/TICL/python/HADStep_cff.py @@ -30,7 +30,7 @@ min_cos_theta = 0.866, # ~30 degrees min_cos_pointing = 0.819, # ~35 degrees max_delta_time = -1, - itername = "HADRONIC" + itername = "HAD" ) # MULTICLUSTERS diff --git a/RecoHGCal/TICL/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py new file mode 100644 index 0000000000000..8aa9d1a9fd8c7 --- /dev/null +++ b/RecoHGCal/TICL/python/SimTracksters_cff.py @@ -0,0 +1,31 @@ +import FWCore.ParameterSet.Config as cms + +from RecoHGCal.TICL.trackstersFromSimClustersProducer_cfi import trackstersFromSimClustersProducer as _trackstersFromSimClustersProducer +from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer +from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer + + +# CA - PATTERN RECOGNITION + + +filteredLayerClustersSimTracksters = _filteredLayerClustersProducer.clone( + clusterFilter = "ClusterFilterByAlgoAndSize", + algo_number = 8, + min_cluster_size = 0, # inclusive + iteration_label = "ticlSimTracksters" +) + +ticlSimTracksters = _trackstersFromSimClustersProducer.clone( +) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(ticlSimTracksters, + simclusters = "mixData:MergedCaloTruth" +) + +ticlMultiClustersFromSimTracksters = _multiClustersFromTrackstersProducer.clone( + Tracksters = "ticlSimTracksters" +) + +ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters, ticlMultiClustersFromSimTracksters) + diff --git a/RecoHGCal/TICL/python/TrkStep_cff.py b/RecoHGCal/TICL/python/TrkStep_cff.py index 739a7cafd5d2b..2529264542862 100644 --- a/RecoHGCal/TICL/python/TrkStep_cff.py +++ b/RecoHGCal/TICL/python/TrkStep_cff.py @@ -32,7 +32,7 @@ algo_verbosity = 2, oneTracksterPerTrackSeed = True, promoteEmptyRegionToTrackster = True, - itername = "TRK" + itername = "Trk" ) # MULTICLUSTERS diff --git a/RecoHGCal/TICL/python/iterativeTICL_cff.py b/RecoHGCal/TICL/python/iterativeTICL_cff.py index 9c961d580d09e..7ea82224b5611 100644 --- a/RecoHGCal/TICL/python/iterativeTICL_cff.py +++ b/RecoHGCal/TICL/python/iterativeTICL_cff.py @@ -5,6 +5,7 @@ from RecoHGCal.TICL.TrkStep_cff import * from RecoHGCal.TICL.EMStep_cff import * from RecoHGCal.TICL.HADStep_cff import * + from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer as _pfTICLProducer from RecoHGCal.TICL.trackstersMergeProducer_cfi import trackstersMergeProducer as _trackstersMergeProducer @@ -22,14 +23,20 @@ pfTICL = _pfTICLProducer.clone() ticlPFTask = cms.Task(pfTICL) -iterTICLTask = cms.Task(ticlLayerTileTask - ,ticlTrkEMStepTask +ticlIterationsTask = cms.Task( + ticlTrkEMStepTask ,ticlEMStepTask ,ticlTrkStepTask ,ticlHADStepTask +) +ticlIterLabels = [_step.itername.value() for _iteration in ticlIterationsTask for _step in _iteration if (_step._TypedParameterizable__type == "TrackstersProducer")] + +iterTICLTask = cms.Task(ticlLayerTileTask + ,ticlIterationsTask ,ticlTracksterMergeTask ,ticlPFTask - ) +) +ticlIterLabelsMerge = ticlIterLabels + ["Merge"] ticlLayerTileHFNose = ticlLayerTileProducer.clone( detector = 'HFNose' diff --git a/RecoJets/JetProducers/python/caloJetsForTrk_cff.py b/RecoJets/JetProducers/python/caloJetsForTrk_cff.py index 0f66e78976b33..72c5f21386fcf 100644 --- a/RecoJets/JetProducers/python/caloJetsForTrk_cff.py +++ b/RecoJets/JetProducers/python/caloJetsForTrk_cff.py @@ -4,7 +4,8 @@ from RecoHI.HiJetAlgos.HiRecoJets_cff import akPu4CaloJets as _akPu4CaloJets from RecoLocalCalo.CaloTowersCreator.calotowermaker_cfi import calotowermaker caloTowerForTrk = calotowermaker.clone( - hbheInput='hbheprereco' + hbheInput='hbheprereco', + missingHcalRescaleFactorForEcal = 1.0 ) ak4CaloJetsForTrk = _ak4CaloJets.clone( @@ -26,8 +27,8 @@ caloJetsForTrkTask = cms.Task(caloTowerForTrk,ak4CaloJetsForTrk) caloJetsForTrk = cms.Sequence(caloJetsForTrkTask) -from Configuration.Eras.Modifier_pf_badHcalMitigation_cff import pf_badHcalMitigation -pf_badHcalMitigation.toModify( caloTowerForTrk, missingHcalRescaleFactorForEcal = 1.0 ) - from Configuration.Eras.Modifier_run3_HB_cff import run3_HB run3_HB.toModify( caloTowerForTrk, hbheInput = "hbhereco" ) + +from Configuration.Eras.Modifier_pf_badHcalMitigationOff_cff import pf_badHcalMitigationOff +pf_badHcalMitigationOff.toModify( caloTowerForTrk, missingHcalRescaleFactorForEcal = 0.0 ) diff --git a/RecoLocalCalo/HGCalRecProducers/BuildFile.xml b/RecoLocalCalo/HGCalRecProducers/BuildFile.xml index caf337a1ffdd6..f00af183cc775 100644 --- a/RecoLocalCalo/HGCalRecProducers/BuildFile.xml +++ b/RecoLocalCalo/HGCalRecProducers/BuildFile.xml @@ -1,19 +1,9 @@ - - - - - - - - - - diff --git a/RecoLocalCalo/HGCalRecProducers/plugins/BuildFile.xml b/RecoLocalCalo/HGCalRecProducers/plugins/BuildFile.xml index ddd7b85e4f9b0..5118f4ebfdc12 100644 --- a/RecoLocalCalo/HGCalRecProducers/plugins/BuildFile.xml +++ b/RecoLocalCalo/HGCalRecProducers/plugins/BuildFile.xml @@ -1,9 +1,12 @@ + + + @@ -13,7 +16,6 @@ - diff --git a/RecoLocalCalo/HcalRecProducers/python/hfQIE10Reco_cfi.py b/RecoLocalCalo/HcalRecProducers/python/hfQIE10Reco_cfi.py index fdd23952d79e9..3d379ab9722aa 100644 --- a/RecoLocalCalo/HcalRecProducers/python/hfQIE10Reco_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/hfQIE10Reco_cfi.py @@ -1,15 +1,11 @@ import FWCore.ParameterSet.Config as cms +import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi as _mod -hfQIE10Reco = cms.EDProducer("HcalSimpleReconstructor", - correctionPhaseNS = cms.double(0.0), - digiLabel = cms.InputTag("simHcalUnsuppressedDigis","HFQIE10DigiCollection"), - Subdetector = cms.string('HFQIE10'), - correctForPhaseContainment = cms.bool(False), - correctForTimeslew = cms.bool(False), - dropZSmarkedPassed = cms.bool(True), - firstSample = cms.int32(2), - samplesToAdd = cms.int32(1), - tsFromDB = cms.bool(True) +hfQIE10Reco = _mod.hfsimplereco.clone( + digiLabel = "simHcalUnsuppressedDigis:HFQIE10DigiCollection", + Subdetector = 'HFQIE10', + firstSample = 2, + samplesToAdd = 1 ) diff --git a/RecoLocalFastTime/FTLClusterizer/plugins/MTDClusterProducer.cc b/RecoLocalFastTime/FTLClusterizer/plugins/MTDClusterProducer.cc index dd6afb169d759..a812971066bbe 100644 --- a/RecoLocalFastTime/FTLClusterizer/plugins/MTDClusterProducer.cc +++ b/RecoLocalFastTime/FTLClusterizer/plugins/MTDClusterProducer.cc @@ -62,6 +62,8 @@ class MTDClusterProducer : public edm::stream::EDProducer<> { const MTDGeometry* geom_; const MTDTopology* topo_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; }; //--------------------------------------------------------------------------- @@ -79,6 +81,9 @@ MTDClusterProducer::MTDClusterProducer(edm::ParameterSet const& conf) produces(ftlbInstance_); produces(ftleInstance_); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); + //--- Make the algorithm(s) according to what the user specified //--- in the ParameterSet. if (clusterMode_ == "MTDThresholdClusterizer") { @@ -114,12 +119,10 @@ void MTDClusterProducer::produce(edm::Event& e, const edm::EventSetup& es) { e.getByToken(etlHits_, inputEndcap); // Step A.2: get event setup - edm::ESHandle geom; - es.get().get(geom); + auto geom = es.getTransientHandle(mtdgeoToken_); geom_ = geom.product(); - edm::ESHandle mtdTopo; - es.get().get(mtdTopo); + auto mtdTopo = es.getTransientHandle(mtdtopoToken_); topo_ = mtdTopo.product(); // Step B: create the final output collection diff --git a/RecoLocalFastTime/FTLCommonAlgos/BuildFile.xml b/RecoLocalFastTime/FTLCommonAlgos/BuildFile.xml index 65f7935c52763..3833c49c36ad3 100644 --- a/RecoLocalFastTime/FTLCommonAlgos/BuildFile.xml +++ b/RecoLocalFastTime/FTLCommonAlgos/BuildFile.xml @@ -1,10 +1,7 @@ - - - diff --git a/RecoLocalFastTime/FTLCommonAlgos/interface/RecHitTools.h b/RecoLocalFastTime/FTLCommonAlgos/interface/RecHitTools.h deleted file mode 100644 index 52a3c29aae99f..0000000000000 --- a/RecoLocalFastTime/FTLCommonAlgos/interface/RecHitTools.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __RecoLocalFastTime_FTLCommonAlgos_RecHitTools_h__ -#define __RecoLocalFastTime_FTLCommonAlgos_RecHitTools_h__ - -#include -#include -#include "Geometry/HGCalGeometry/interface/FastTimeGeometry.h" - -namespace edm { - class Event; - class EventSetup; -} // namespace edm - -namespace ftl { - class RecHitTools { - public: - RecHitTools() : geom_(nullptr), ddd_(nullptr) {} - ~RecHitTools() {} - - enum HitType { UNKNOWN = 0, LYSO = 1, Silicon = 2 }; - - void getEvent(const edm::Event&); - void getEventSetup(const edm::EventSetup&); - - GlobalPoint getPosition(const DetId& id) const; - FlatTrd::CornersVec getCorners(const DetId& id) const; - - HitType getHitType(const DetId& id) const; - - private: - const FastTimeGeometry* geom_; - const FastTimeDDDConstants* ddd_; - }; -} // namespace ftl - -#endif diff --git a/RecoLocalFastTime/FTLCommonAlgos/plugins/BuildFile.xml b/RecoLocalFastTime/FTLCommonAlgos/plugins/BuildFile.xml index 1d87fd05f6b84..4ddc8b413c325 100644 --- a/RecoLocalFastTime/FTLCommonAlgos/plugins/BuildFile.xml +++ b/RecoLocalFastTime/FTLCommonAlgos/plugins/BuildFile.xml @@ -1,3 +1,4 @@ + diff --git a/RecoLocalFastTime/FTLCommonAlgos/plugins/MTDRecHitAlgo.cc b/RecoLocalFastTime/FTLCommonAlgos/plugins/MTDRecHitAlgo.cc index 4c2f7a225c6b8..40f7c2789d96a 100644 --- a/RecoLocalFastTime/FTLCommonAlgos/plugins/MTDRecHitAlgo.cc +++ b/RecoLocalFastTime/FTLCommonAlgos/plugins/MTDRecHitAlgo.cc @@ -6,10 +6,7 @@ class MTDRecHitAlgo : public MTDRecHitAlgoBase { public: /// Constructor - MTDRecHitAlgo(const edm::ParameterSet& conf, edm::ConsumesCollector& sumes) - : MTDRecHitAlgoBase(conf, sumes), - thresholdToKeep_(conf.getParameter("thresholdToKeep")), - calibration_(conf.getParameter("calibrationConstant")) {} + MTDRecHitAlgo(const edm::ParameterSet& conf, edm::ConsumesCollector& sumes); /// Destructor ~MTDRecHitAlgo() override {} @@ -24,11 +21,18 @@ class MTDRecHitAlgo : public MTDRecHitAlgoBase { private: double thresholdToKeep_, calibration_; const MTDTimeCalib* time_calib_; + edm::ESGetToken tcToken_; }; +MTDRecHitAlgo::MTDRecHitAlgo(const edm::ParameterSet& conf, edm::ConsumesCollector& sumes) + : MTDRecHitAlgoBase(conf, sumes), + thresholdToKeep_(conf.getParameter("thresholdToKeep")), + calibration_(conf.getParameter("calibrationConstant")) { + tcToken_ = sumes.esConsumes(edm::ESInputTag("", "MTDTimeCalib")); +} + void MTDRecHitAlgo::getEventSetup(const edm::EventSetup& es) { - edm::ESHandle pTC; - es.get().get("MTDTimeCalib", pTC); + auto pTC = es.getHandle(tcToken_); time_calib_ = pTC.product(); } diff --git a/RecoLocalFastTime/FTLCommonAlgos/src/RecHitTools.cc b/RecoLocalFastTime/FTLCommonAlgos/src/RecHitTools.cc deleted file mode 100644 index ac5e4b1e34c17..0000000000000 --- a/RecoLocalFastTime/FTLCommonAlgos/src/RecHitTools.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include "RecoLocalFastTime/FTLCommonAlgos/interface/RecHitTools.h" - -#include "DataFormats/ForwardDetId/interface/FastTimeDetId.h" - -#include "Geometry/Records/interface/FastTimeGeometryRecord.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" - -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -using namespace ftl; - -void RecHitTools::getEvent(const edm::Event& ev) {} - -void RecHitTools::getEventSetup(const edm::EventSetup& es) { - edm::ESHandle ftgeom; - es.get().get(ftgeom); - geom_ = ftgeom.product(); - ddd_ = &(geom_->topology().dddConstants()); -} - -GlobalPoint RecHitTools::getPosition(const DetId& id) const { return geom_->getGeometry(id)->getPosition(); } - -FlatTrd::CornersVec RecHitTools::getCorners(const DetId& id) const { return geom_->getGeometry(id)->getCorners(); } - -RecHitTools::HitType RecHitTools::getHitType(const DetId& id) const { - FastTimeDetId fid(id); - return (HitType)fid.type(); -} diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/MTDRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/MTDRecHitProducer.cc index bcc2fd7d5c5db..72bddde9008b9 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/MTDRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/MTDRecHitProducer.cc @@ -35,6 +35,7 @@ class MTDRecHitProducer : public edm::stream::EDProducer<> { std::unique_ptr barrel_, endcap_; const MTDGeometry* geom_; + edm::ESGetToken mtdgeoToken_; }; MTDRecHitProducer::MTDRecHitProducer(const edm::ParameterSet& ps) @@ -48,6 +49,7 @@ MTDRecHitProducer::MTDRecHitProducer(const edm::ParameterSet& ps) produces(ftleInstance_); auto sumes = consumesCollector(); + mtdgeoToken_ = esConsumes(); const edm::ParameterSet& barrel = ps.getParameterSet("barrel"); const std::string& barrelAlgo = barrel.getParameter("algoName"); @@ -61,8 +63,7 @@ MTDRecHitProducer::MTDRecHitProducer(const edm::ParameterSet& ps) MTDRecHitProducer::~MTDRecHitProducer() {} void MTDRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { - edm::ESHandle geom; - es.get().get(geom); + auto geom = es.getTransientHandle(mtdgeoToken_); geom_ = geom.product(); // tranparently get things from event setup diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/MTDTrackingRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/MTDTrackingRecHitProducer.cc index acec43bb106c0..794fffbe29987 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/MTDTrackingRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/MTDTrackingRecHitProducer.cc @@ -44,12 +44,16 @@ class MTDTrackingRecHitProducer : public edm::stream::EDProducer<> { const MTDGeometry* geom_; const MTDClusterParameterEstimator* cpe_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken cpeToken_; }; MTDTrackingRecHitProducer::MTDTrackingRecHitProducer(const edm::ParameterSet& ps) : ftlbClusters_(consumes(ps.getParameter("barrelClusters"))), ftleClusters_(consumes(ps.getParameter("endcapClusters"))) { produces(); + mtdgeoToken_ = esConsumes(); + cpeToken_ = esConsumes(edm::ESInputTag("", "MTDCPEBase")); } // Configuration descriptions @@ -61,12 +65,10 @@ void MTDTrackingRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& } void MTDTrackingRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { - edm::ESHandle geom; - es.get().get(geom); + auto geom = es.getTransientHandle(mtdgeoToken_); geom_ = geom.product(); - edm::ESHandle cpe; - es.get().get("MTDCPEBase", cpe); + auto cpe = es.getTransientHandle(cpeToken_); cpe_ = cpe.product(); edm::Handle inputBarrel; diff --git a/RecoLocalFastTime/FTLRecProducers/test/MTDRecoDump.cc b/RecoLocalFastTime/FTLRecProducers/test/MTDRecoDump.cc index 5c82b013da79e..bad84e01b80a4 100644 --- a/RecoLocalFastTime/FTLRecProducers/test/MTDRecoDump.cc +++ b/RecoLocalFastTime/FTLRecProducers/test/MTDRecoDump.cc @@ -14,14 +14,14 @@ class MTDRecoDump : public edm::one::EDAnalyzer { public: explicit MTDRecoDump(const edm::ParameterSet&); - ~MTDRecoDump(); + ~MTDRecoDump() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void beginJob() override; - virtual void analyze(const edm::Event&, const edm::EventSetup&) override; - virtual void endJob() override; + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; // ----------member data --------------------------- @@ -54,7 +54,7 @@ void MTDRecoDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu // --- BTL RECOs: - if (h_BTL_reco->size() > 0) { + if (!h_BTL_reco->empty()) { std::cout << " ----------------------------------------" << std::endl; std::cout << " BTL RECO collection:" << std::endl; @@ -74,7 +74,7 @@ void MTDRecoDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu // --- ETL RECOs: - if (h_ETL_reco->size() > 0) { + if (!h_ETL_reco->empty()) { std::cout << " ----------------------------------------" << std::endl; std::cout << " ETL RECO collection:" << std::endl; diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterThresholds.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterThresholds.h new file mode 100644 index 0000000000000..41dd430262f73 --- /dev/null +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterThresholds.h @@ -0,0 +1,14 @@ +#ifndef RecoLocalTracker_SiPixelClusterizer_plugins_SiPixelClusterThresholds_h +#define RecoLocalTracker_SiPixelClusterizer_plugins_SiPixelClusterThresholds_h + +struct SiPixelClusterThresholds { + inline constexpr int32_t getThresholdForLayerOnCondition(bool isLayer1) const noexcept { + return isLayer1 ? layer1 : otherLayers; + } + const int32_t layer1; + const int32_t otherLayers; +}; + +constexpr SiPixelClusterThresholds kSiPixelClusterThresholdsDefaultPhase1{.layer1 = 2000, .otherLayers = 4000}; + +#endif // RecoLocalTracker_SiPixelClusterizer_plugins_SiPixelClusterThresholds_h diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc index 0078bae38306a..b6484dbea915e 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc @@ -15,7 +15,10 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "RecoLocalTracker/SiPixelClusterizer/plugins/PixelClusterizerBase.h" + +// local include(s) +#include "PixelClusterizerBase.h" +#include "SiPixelClusterThresholds.h" class SiPixelDigisClustersFromSoA : public edm::global::EDProducer<> { public: @@ -33,17 +36,23 @@ class SiPixelDigisClustersFromSoA : public edm::global::EDProducer<> { edm::EDPutTokenT> digiPutToken_; edm::EDPutTokenT clusterPutToken_; + + const SiPixelClusterThresholds clusterThresholds_; // Cluster threshold in electrons }; SiPixelDigisClustersFromSoA::SiPixelDigisClustersFromSoA(const edm::ParameterSet& iConfig) : topoToken_(esConsumes()), digiGetToken_(consumes(iConfig.getParameter("src"))), digiPutToken_(produces>()), - clusterPutToken_(produces()) {} + clusterPutToken_(produces()), + clusterThresholds_{iConfig.getParameter("clusterThreshold_layer1"), + iConfig.getParameter("clusterThreshold_otherLayers")} {} void SiPixelDigisClustersFromSoA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("src", edm::InputTag("siPixelDigisSoA")); + desc.add("clusterThreshold_layer1", kSiPixelClusterThresholdsDefaultPhase1.layer1); + desc.add("clusterThreshold_otherLayers", kSiPixelClusterThresholdsDefaultPhase1.otherLayers); descriptions.addWithDefaultLabel(desc); } @@ -77,7 +86,7 @@ void SiPixelDigisClustersFromSoA::produce(edm::StreamID, edm::Event& iEvent, con return; // this in reality should never happen edmNew::DetSetVector::FastFiller spc(*outputClusters, detId); auto layer = (DetId(detId).subdetId() == 1) ? ttopo.pxbLayer(detId) : 0; - auto clusterThreshold = (layer == 1) ? 2000 : 4000; + auto clusterThreshold = clusterThresholds_.getThresholdForLayerOnCondition(layer == 1); for (int32_t ic = 0; ic < nclus + 1; ++ic) { auto const& acluster = aclusters[ic]; // in any case we cannot go out of sync with gpu... diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterCUDA.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterCUDA.cc index 93b92e145ec5c..ad43f0d9416d2 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterCUDA.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterCUDA.cc @@ -37,6 +37,7 @@ #include "RecoTracker/Record/interface/CkfComponentsRecord.h" // local includes +#include "SiPixelClusterThresholds.h" #include "SiPixelRawToClusterGPUKernel.h" class SiPixelRawToClusterCUDA : public edm::stream::EDProducer { @@ -77,6 +78,7 @@ class SiPixelRawToClusterCUDA : public edm::stream::EDProducer("CablingMapLabel")))), isRun2_(iConfig.getParameter("isRun2")), includeErrors_(iConfig.getParameter("IncludeErrors")), - useQuality_(iConfig.getParameter("UseQualityInfo")) { + useQuality_(iConfig.getParameter("UseQualityInfo")), + clusterThresholds_{iConfig.getParameter("clusterThreshold_layer1"), + iConfig.getParameter("clusterThreshold_otherLayers")} { if (includeErrors_) { digiErrorPutToken_ = produces>(); } @@ -110,6 +114,8 @@ void SiPixelRawToClusterCUDA::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("isRun2", true); desc.add("IncludeErrors", true); desc.add("UseQualityInfo", false); + desc.add("clusterThreshold_layer1", kSiPixelClusterThresholdsDefaultPhase1.layer1); + desc.add("clusterThreshold_otherLayers", kSiPixelClusterThresholdsDefaultPhase1.otherLayers); desc.add("InputLabel", edm::InputTag("rawDataCollector")); { edm::ParameterSetDescription psd0; @@ -231,6 +237,7 @@ void SiPixelRawToClusterCUDA::acquire(const edm::Event& iEvent, } // end of for loop gpuAlgo_.makeClustersAsync(isRun2_, + clusterThresholds_, gpuMap, gpuModulesToUnpack, gpuGains, diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu index 25e5c925990f8..6bebcd9ea7aab 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu @@ -500,16 +500,11 @@ namespace pixelgpudetails { printf("moduleStart %d %d\n", i, moduleStart[i]); } #endif - - // avoid overflow - auto constexpr maxNumClusters = gpuClustering::maxNumClusters; - for (int i = first, iend = gpuClustering::maxNumModules + 1; i < iend; i += blockDim.x) { - moduleStart[i] = std::clamp(moduleStart[i], 0U, maxNumClusters); - } } // Interface to outside void SiPixelRawToClusterGPUKernel::makeClustersAsync(bool isRun2, + const SiPixelClusterThresholds clusterThresholds, const SiPixelROCsStatusAndMapping *cablingMap, const unsigned char *modToUnp, const SiPixelGainForHLTonGPU *gains, @@ -635,7 +630,8 @@ namespace pixelgpudetails { #endif // apply charge cut - clusterChargeCut<<>>(digis_d.moduleInd(), + clusterChargeCut<<>>(clusterThresholds, + digis_d.moduleInd(), digis_d.adc(), clusters_d.moduleStart(), clusters_d.clusInModule(), diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h index 75eeab2606dd5..07f2a25baeb73 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h @@ -14,6 +14,9 @@ #include "DataFormats/SiPixelRawData/interface/SiPixelErrorCompact.h" #include "DataFormats/SiPixelRawData/interface/SiPixelFormatterErrors.h" +// local include(s) +#include "SiPixelClusterThresholds.h" + struct SiPixelROCsStatusAndMapping; class SiPixelGainForHLTonGPU; @@ -170,6 +173,7 @@ namespace pixelgpudetails { SiPixelRawToClusterGPUKernel& operator=(SiPixelRawToClusterGPUKernel&&) = delete; void makeClustersAsync(bool isRun2, + const SiPixelClusterThresholds clusterThresholds, const SiPixelROCsStatusAndMapping* cablingMap, const unsigned char* modToUnp, const SiPixelGainForHLTonGPU* gains, diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h index d9520da80b695..42a7c4d4a7d78 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h @@ -5,14 +5,20 @@ #include #include "CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h" +#include "Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h" #include "HeterogeneousCore/CUDAUtilities/interface/cuda_assert.h" #include "HeterogeneousCore/CUDAUtilities/interface/prefixScan.h" +// local include(s) +#include "SiPixelClusterThresholds.h" + namespace gpuClustering { __global__ void clusterChargeCut( - uint16_t* __restrict__ id, // module id of each pixel (modified if bad cluster) - uint16_t const* __restrict__ adc, // charge of each pixel + SiPixelClusterThresholds + clusterThresholds, // charge cut on cluster in electrons (for layer 1 and for other layers) + uint16_t* __restrict__ id, // module id of each pixel (modified if bad cluster) + uint16_t const* __restrict__ adc, // charge of each pixel uint32_t const* __restrict__ moduleStart, // index of the first pixel of each module uint32_t* __restrict__ nClustersInModule, // modified: number of clusters found in each module uint32_t const* __restrict__ moduleId, // module id of each module @@ -79,7 +85,8 @@ namespace gpuClustering { } __syncthreads(); - auto chargeCut = thisModuleId < 96 ? 2000 : 4000; // move in constants (calib?) + auto chargeCut = + clusterThresholds.getThresholdForLayerOnCondition(thisModuleId < phase1PixelTopology::layerStart[1]); for (auto i = threadIdx.x; i < nclus; i += blockDim.x) { newclusId[i] = ok[i] = charge[i] > chargeCut ? 1 : 0; } diff --git a/RecoLocalTracker/SiPixelClusterizer/test/gpuClustering_t.h b/RecoLocalTracker/SiPixelClusterizer/test/gpuClustering_t.h index 02611ab1cac1d..a67cec3051304 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/gpuClustering_t.h +++ b/RecoLocalTracker/SiPixelClusterizer/test/gpuClustering_t.h @@ -18,6 +18,7 @@ #include "RecoLocalTracker/SiPixelClusterizer/plugins/gpuClustering.h" #include "RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h" +#include "RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterThresholds.h" int main(void) { #ifdef __CUDACC__ @@ -27,6 +28,7 @@ int main(void) { using namespace gpuClustering; constexpr int numElements = 256 * maxNumModules; + constexpr SiPixelClusterThresholds clusterThresholds(kSiPixelClusterThresholdsDefaultPhase1); // these in reality are already on GPU auto h_id = std::make_unique(numElements); @@ -288,6 +290,7 @@ int main(void) { cms::cuda::launch(clusterChargeCut, {blocksPerGrid, threadsPerBlock}, + clusterThresholds, d_id.get(), d_adc.get(), d_moduleStart.get(), @@ -317,8 +320,14 @@ int main(void) { if (ncl != std::accumulate(nclus, nclus + maxNumModules, 0)) std::cout << "ERROR!!!!! wrong number of cluster found" << std::endl; - clusterChargeCut( - h_id.get(), h_adc.get(), h_moduleStart.get(), h_clusInModule.get(), h_moduleId.get(), h_clus.get(), n); + clusterChargeCut(clusterThresholds, + h_id.get(), + h_adc.get(), + h_moduleStart.get(), + h_clusInModule.get(), + h_moduleId.get(), + h_clus.get(), + n); #endif // __CUDACC__ std::cout << "found " << nModules << " Modules active" << std::endl; diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu b/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu index f75d5e3b3bef7..61c228bea3c56 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHitGPUKernel.cu @@ -47,30 +47,29 @@ namespace pixelgpudetails { #ifdef GPU_DEBUG std::cout << "launching getHits kernel for " << blocks << " blocks" << std::endl; #endif - if (blocks) // protect from empty events + // protect from empty events + if (blocks) { gpuPixelRecHits::getHits<<>>( cpeParams, bs_d.data(), digis_d.view(), digis_d.nDigis(), clusters_d.view(), hits_d.view()); - cudaCheck(cudaGetLastError()); + cudaCheck(cudaGetLastError()); #ifdef GPU_DEBUG - cudaDeviceSynchronize(); - cudaCheck(cudaGetLastError()); + cudaCheck(cudaDeviceSynchronize()); #endif + } // assuming full warp of threads is better than a smaller number... if (nHits) { setHitsLayerStart<<<1, 32, 0, stream>>>(clusters_d.clusModuleStart(), cpeParams, hits_d.hitsLayerStart()); cudaCheck(cudaGetLastError()); - } - if (nHits) { - cms::cuda::fillManyFromVector(hits_d.phiBinner(), 10, hits_d.iphi(), hits_d.hitsLayerStart(), nHits, 256, stream); + cms::cuda::fillManyFromVector( + hits_d.phiBinner(), 10, hits_d.iphi(), hits_d.hitsLayerStart(), nHits, 256, hits_d.phiBinnerStorage(), stream); cudaCheck(cudaGetLastError()); - } #ifdef GPU_DEBUG - cudaDeviceSynchronize(); - cudaCheck(cudaGetLastError()); + cudaCheck(cudaDeviceSynchronize()); #endif + } return hits_d; } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitCUDA.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitCUDA.cc index 09b90526bf7db..65846cbb652d6 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitCUDA.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitCUDA.cc @@ -78,12 +78,6 @@ void SiPixelRecHitCUDA::produce(edm::StreamID streamID, edm::Event& iEvent, cons iEvent.getByToken(tBeamSpot, hbs); auto const& bs = ctx.get(*hbs); - auto nHits = clusters.nClusters(); - if (nHits >= TrackingRecHit2DSOAView::maxHits()) { - edm::LogWarning("PixelRecHitGPUKernel") - << "Clusters/Hits Overflow " << nHits << " >= " << TrackingRecHit2DSOAView::maxHits(); - } - ctx.emplace(iEvent, tokenHit_, gpuAlgo_.makeHitsAsync(digis, clusters, bs, fcpe->getGPUProductAsync(ctx.stream()), ctx.stream())); diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc index 790b0da51ecfb..e2f9e1263e429 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc @@ -146,8 +146,6 @@ void SiPixelRecHitFromCUDA::produce(edm::Event& iEvent, edm::EventSetup const& e if (clust.originalId() >= nhits) continue; auto ij = jnd(clust.originalId()); - if (ij >= TrackingRecHit2DSOAView::maxHits()) - continue; // overflow... LocalPoint lp(xl[ij], yl[ij]); LocalError le(xe[ij], 0, ye[ij]); SiPixelRecHitQuality::QualWordType rqw = 0; diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc index b3dafcc45d029..fbf3384ce328c 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc @@ -245,7 +245,7 @@ void SiPixelRecHitSoAFromLegacy::produce(edm::StreamID streamID, edm::Event& iEv output->hitsLayerStart(), numberOfHits, 256, - nullptr); + output->phiBinnerStorage()); LogDebug("SiPixelRecHitSoAFromLegacy") << "created HitSoa for " << numberOfClusters << " clusters in " << numberOfDetUnits << " Dets"; diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h b/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h index 2401fed6c5171..da7d3de7336a8 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h +++ b/RecoLocalTracker/SiPixelRecHits/plugins/gpuPixelRecHits.h @@ -166,7 +166,6 @@ namespace gpuPixelRecHits { for (int ic = threadIdx.x; ic < nClusInIter; ic += blockDim.x) { auto h = first + ic; // output index in global memory - assert(h < TrackingRecHit2DSOAView::maxHits()); assert(h < hits.nHits()); assert(h < clusters.clusModuleStart(me + 1)); diff --git a/RecoMTD/DetLayers/BuildFile.xml b/RecoMTD/DetLayers/BuildFile.xml index a3b2724a92901..b64af40d3e429 100644 --- a/RecoMTD/DetLayers/BuildFile.xml +++ b/RecoMTD/DetLayers/BuildFile.xml @@ -4,6 +4,7 @@ + diff --git a/RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.h b/RecoMTD/DetLayers/interface/BTLDetLayerGeometryBuilder.h similarity index 100% rename from RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.h rename to RecoMTD/DetLayers/interface/BTLDetLayerGeometryBuilder.h diff --git a/RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.h b/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h similarity index 100% rename from RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.h rename to RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h diff --git a/RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h b/RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h index 0fc82b62fae1a..57a4cd620c6b7 100644 --- a/RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h +++ b/RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h @@ -11,6 +11,9 @@ #include "DataFormats/DetId/interface/DetId.h" #include "TrackingTools/DetLayers/interface/DetLayerGeometry.h" +#include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h" +#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" + #include #include @@ -50,6 +53,11 @@ class MTDDetLayerGeometry : public DetLayerGeometry { /// return the DetLayer which correspond to a certain DetId const DetLayer* idToLayer(const DetId& detId) const override; + // Added to allow building the MTDDetLayer from external plugins + void buildLayers(const MTDGeometry* geo, const MTDTopology* mtopo); + + void sortLayers(); + private: /// Add ETL layers /// etllayers.first=forward (+Z), etllayers.second=backward (-Z) @@ -61,8 +69,6 @@ class MTDDetLayerGeometry : public DetLayerGeometry { DetId makeDetLayerId(const DetLayer* detLayer) const; - void sortLayers(); - std::vector etlLayers_fw; std::vector etlLayers_bk; std::vector etlLayers_all; diff --git a/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc b/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc index 93a83d0d95bee..6fd869bc030cc 100644 --- a/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc +++ b/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc @@ -18,8 +18,8 @@ #include "Geometry/Records/interface/MTDTopologyRcd.h" #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" -#include "ETLDetLayerGeometryBuilder.h" -#include "BTLDetLayerGeometryBuilder.h" +#include "RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h" +#include "RecoMTD/DetLayers/interface/BTLDetLayerGeometryBuilder.h" #include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -52,19 +52,12 @@ MTDDetLayerGeometryESProducer::MTDDetLayerGeometryESProducer(const edm::Paramete std::unique_ptr MTDDetLayerGeometryESProducer::produce(const MTDRecoGeometryRecord& record) { auto mtdDetLayerGeometry = std::make_unique(); + auto mtd = record.getHandle(geomToken_); + auto mtdtopo = record.getHandle(mtdtopoToken_); - if (auto mtd = record.getHandle(geomToken_)) { - // Build BTL layers - mtdDetLayerGeometry->addBTLLayers(BTLDetLayerGeometryBuilder::buildLayers(*mtd)); - // Build ETL layers, depends on the scenario - if (auto mtdtopo = record.getHandle(mtdtopoToken_)) { - mtdDetLayerGeometry->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*mtd, mtdtopo->getMTDTopologyMode())); - } else { - LogWarning("MTDDetLayers") << "No MTD topology is available."; - } - } else { - LogWarning("MTDDetLayers") << "No MTD geometry is available."; - } + //The BTL and ETL builders are now called internally by the MTDDetLayerGeometry. + //This allows external plugings to use and build the object. + mtdDetLayerGeometry->buildLayers(&(*mtd), &(*mtdtopo)); // Sort layers properly mtdDetLayerGeometry->sortLayers(); diff --git a/RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.cc similarity index 97% rename from RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.cc rename to RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.cc index 3d53848e01274..5abd51a8cdce0 100644 --- a/RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.cc @@ -1,6 +1,6 @@ //#define EDM_ML_DEBUG -#include "BTLDetLayerGeometryBuilder.h" +#include "RecoMTD/DetLayers/interface/BTLDetLayerGeometryBuilder.h" #include #include diff --git a/RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc similarity index 98% rename from RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc rename to RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc index 81f0597d9835b..83af5cda4e386 100644 --- a/RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc @@ -1,6 +1,6 @@ //#define EDM_ML_DEBUG -#include "ETLDetLayerGeometryBuilder.h" +#include "RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h" #include #include @@ -66,9 +66,6 @@ pair, vector > ETLDetLayerGeometryBuilder::buildLay } } } - // - // the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0) - // pair, vector > res_pair(result[1], result[0]); return res_pair; } diff --git a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc index be76d374b1ea0..61e92406557e8 100644 --- a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc +++ b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc @@ -5,6 +5,8 @@ */ #include +#include +#include #include #include @@ -14,15 +16,32 @@ #include #include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include using namespace std; using namespace geomsort; +using namespace edm; MTDDetLayerGeometry::MTDDetLayerGeometry() {} MTDDetLayerGeometry::~MTDDetLayerGeometry() {} +void MTDDetLayerGeometry::buildLayers(const MTDGeometry* geo, const MTDTopology* mtopo) { + if (geo) { + // Build BTL layers + this->addBTLLayers(BTLDetLayerGeometryBuilder::buildLayers(*geo)); + // Build ETL layers, depends on the scenario + if (mtopo) { + this->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*geo, mtopo->getMTDTopologyMode())); + } else { + LogWarning("MTDDetLayers") << "No MTD topology is available."; + } + } else { + LogWarning("MTDDetLayers") << "No MTD geometry is available."; + } +} + void MTDDetLayerGeometry::addETLLayers(const pair, vector >& etllayers) { for (auto const it : etllayers.first) { etlLayers_fw.push_back(it); diff --git a/RecoMTD/DetLayers/test/MTDRecoGeometryAnalyzer.cc b/RecoMTD/DetLayers/test/MTDRecoGeometryAnalyzer.cc index cc146357fca6f..af9b1538a19bf 100644 --- a/RecoMTD/DetLayers/test/MTDRecoGeometryAnalyzer.cc +++ b/RecoMTD/DetLayers/test/MTDRecoGeometryAnalyzer.cc @@ -42,7 +42,7 @@ class MTDRecoGeometryAnalyzer : public EDAnalyzer { public: MTDRecoGeometryAnalyzer(const ParameterSet& pset); - virtual void analyze(const Event& ev, const EventSetup& es); + void analyze(const Event& ev, const EventSetup& es) override; void testBTLLayers(const MTDDetLayerGeometry*, const MagneticField* field); void testETLLayers(const MTDDetLayerGeometry*, const MagneticField* field); @@ -169,7 +169,7 @@ void MTDRecoGeometryAnalyzer::testBTLLayers(const MTDDetLayerGeometry* geo, cons << comp.second.globalPosition().z(); vector compDets = layer->compatibleDets(tsos, prop, *theEstimator); - if (compDets.size()) { + if (!compDets.empty()) { LogVerbatim("MTDLayerDump") << "compatibleDets: " << std::setw(14) << compDets.size() << "\n" << " final state pos: " << std::setw(14) << compDets.front().second.globalPosition() << "\n" @@ -226,7 +226,7 @@ void MTDRecoGeometryAnalyzer::testETLLayers(const MTDDetLayerGeometry* geo, cons << comp.second.globalPosition().z(); vector compDets = layer->compatibleDets(tsos, prop, *theEstimator); - if (compDets.size()) { + if (!compDets.empty()) { LogVerbatim("MTDLayerDump") << "compatibleDets: " << std::setw(14) << compDets.size() << "\n" << " final state pos: " << std::setw(14) << compDets.front().second.globalPosition() << "\n" @@ -312,7 +312,7 @@ void MTDRecoGeometryAnalyzer::testETLLayersNew(const MTDDetLayerGeometry* geo, c << comp.second.globalPosition().z(); vector compDets = layer->compatibleDets(tsos, prop, *theEstimator); - if (compDets.size()) { + if (!compDets.empty()) { LogVerbatim("MTDLayerDump") << std::fixed << "compatibleDets: " << std::setw(14) << compDets.size() << "\n" << " final state pos: " << compDets.front().second.globalPosition() << "\n" @@ -335,9 +335,9 @@ void MTDRecoGeometryAnalyzer::testETLLayersNew(const MTDDetLayerGeometry* geo, c string MTDRecoGeometryAnalyzer::dumpLayer(const DetLayer* layer) const { stringstream output; - const BoundSurface* sur = 0; - const BoundCylinder* bc = 0; - const BoundDisk* bd = 0; + const BoundSurface* sur = nullptr; + const BoundCylinder* bc = nullptr; + const BoundDisk* bd = nullptr; sur = &(layer->surface()); if ((bc = dynamic_cast(sur))) { diff --git a/RecoMTD/Navigation/BuildFile.xml b/RecoMTD/Navigation/BuildFile.xml deleted file mode 100644 index 2a44a670f28cb..0000000000000 --- a/RecoMTD/Navigation/BuildFile.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/RecoMTD/Navigation/interface/BTLNavigableLayer.h b/RecoMTD/Navigation/interface/BTLNavigableLayer.h deleted file mode 100644 index e74b057899b93..0000000000000 --- a/RecoMTD/Navigation/interface/BTLNavigableLayer.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef Navigation_BTLNavigableLayer_H -#define Navigation_BTLNavigableLayer_H - -/** \class BTLNavigableLayer - * - * Navigable layer for Barrel Timing Layer. - * Taken from MuonBarrelNavigableLayer. - * - * - * \author : L. Gray - FNAL - * - */ - -/* Collaborating Class Declarations */ -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" - -class DetLayer; -class BarrelDetLayer; - -/* Base Class Headers */ -#include "RecoMTD/Navigation/interface/MTDNavigableLayer.h" -/* C++ Headers */ - -/* ====================================================================== */ - -/* Class BTLNavigableLayer Interface */ - -class BTLNavigableLayer : public MTDNavigableLayer { -public: - /// Constructor - BTLNavigableLayer(BarrelDetLayer* bdl, - const MapB& outerBarrel, - const MapB& innerBarrel, - const MapE& outerBackward, - const MapE& outerForward, - const MapE& innerBackward, - const MapE& innerForward) - : theDetLayer(bdl), - theOuterBarrelLayers(outerBarrel), - theInnerBarrelLayers(innerBarrel), - theOuterBackwardLayers(outerBackward), - theInnerBackwardLayers(innerBackward), - theOuterForwardLayers(outerForward), - theInnerForwardLayers(innerForward) {} - - BTLNavigableLayer(BarrelDetLayer* bdl, - const MapB& outerBarrel, - const MapB& innerBarrel, - const MapE& outerBackward, - const MapE& outerForward, - const MapE& innerBackward, - const MapE& innerForward, - const MapB& allOuterBarrel, - const MapB& allInnerBarrel, - const MapE& allOuterBackward, - const MapE& allOuterForward, - const MapE& allInnerBackward, - const MapE& allInnerForward) - : theDetLayer(bdl), - theOuterBarrelLayers(outerBarrel), - theInnerBarrelLayers(innerBarrel), - theOuterBackwardLayers(outerBackward), - theInnerBackwardLayers(innerBackward), - theOuterForwardLayers(outerForward), - theInnerForwardLayers(innerForward), - theAllOuterBarrelLayers(allOuterBarrel), - theAllInnerBarrelLayers(allInnerBarrel), - theAllOuterBackwardLayers(allOuterBackward), - theAllInnerBackwardLayers(allInnerBackward), - theAllOuterForwardLayers(allOuterForward), - theAllInnerForwardLayers(allInnerForward) {} - - /// Constructor with outer layers only - BTLNavigableLayer(BarrelDetLayer* bdl, const MapB& outerBarrel, const MapE& outerBackward, const MapE& outerForward) - : theDetLayer(bdl), - theOuterBarrelLayers(outerBarrel), - theOuterBackwardLayers(outerBackward), - theOuterForwardLayers(outerForward) {} - - BTLNavigableLayer(const BarrelDetLayer* bdl, - const MapB& outerBarrel, - const MapE& outerBackward, - const MapE& outerForward, - const MapB& allOuterBarrel, - const MapE& allOuterBackward, - const MapE& allOuterForward) - : theDetLayer(bdl), - theOuterBarrelLayers(outerBarrel), - theOuterBackwardLayers(outerBackward), - theOuterForwardLayers(outerForward), - theAllOuterBarrelLayers(allOuterBarrel), - theAllOuterBackwardLayers(allOuterBackward), - theAllOuterForwardLayers(allOuterForward) {} - - /// NavigableLayer interface - std::vector nextLayers(NavigationDirection dir) const override; - - /// NavigableLayer interface - std::vector nextLayers(const FreeTrajectoryState& fts, PropagationDirection dir) const override; - - std::vector compatibleLayers(NavigationDirection dir) const override; - - /// NavigableLayer interface - std::vector compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const override; - - /// return DetLayer - const DetLayer* detLayer() const override; - - /// set DetLayer - void setDetLayer(const DetLayer*) override; - - MapB getOuterBarrelLayers() const { return theOuterBarrelLayers; } - MapB getInnerBarrelLayers() const { return theInnerBarrelLayers; } - MapE getOuterBackwardLayers() const { return theOuterBackwardLayers; } - MapE getInnerBackwardLayers() const { return theInnerBackwardLayers; } - MapE getOuterForwardLayers() const { return theOuterForwardLayers; } - MapE getInnerForwardLayers() const { return theInnerForwardLayers; } - - MapB getAllOuterBarrelLayers() const { return theAllOuterBarrelLayers; } - MapB getAllInnerBarrelLayers() const { return theAllInnerBarrelLayers; } - MapE getAllOuterBackwardLayers() const { return theAllOuterBackwardLayers; } - MapE getAllInnerBackwardLayers() const { return theAllInnerBackwardLayers; } - MapE getAllOuterForwardLayers() const { return theAllOuterForwardLayers; } - MapE getAllInnerForwardLayers() const { return theAllInnerForwardLayers; } - - /// set inward links - void setInwardLinks(const MapB&); - void setInwardCompatibleLinks(const MapB&); - -private: - void pushResult(std::vector& result, const MapB& map) const; - - void pushResult(std::vector& result, const MapE& map) const; - - void pushResult(std::vector& result, const MapB& map, const FreeTrajectoryState& fts) const; - - void pushResult(std::vector& result, const MapE& map, const FreeTrajectoryState& fts) const; - void pushCompatibleResult(std::vector& result, - const MapB& map, - const FreeTrajectoryState& fts) const; - - void pushCompatibleResult(std::vector& result, - const MapE& map, - const FreeTrajectoryState& fts) const; - -private: - const BarrelDetLayer* theDetLayer; - MapB theOuterBarrelLayers; - MapB theInnerBarrelLayers; - MapE theOuterBackwardLayers; - MapE theInnerBackwardLayers; - MapE theOuterForwardLayers; - MapE theInnerForwardLayers; - MapB theAllOuterBarrelLayers; - MapB theAllInnerBarrelLayers; - MapE theAllOuterBackwardLayers; - MapE theAllInnerBackwardLayers; - MapE theAllOuterForwardLayers; - MapE theAllInnerForwardLayers; -}; -#endif diff --git a/RecoMTD/Navigation/interface/DirectMTDNavigation.h b/RecoMTD/Navigation/interface/DirectMTDNavigation.h deleted file mode 100644 index f2f78d26862de..0000000000000 --- a/RecoMTD/Navigation/interface/DirectMTDNavigation.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef Navigation_DirectMTDNavigation_H -#define Navigation_DirectMTDNavigation_H -/** \file DirectMTDNavigation - * - * do a straight line extrapolation to - * find out compatible DetLayers with a given FTS - * - * \author Chang Liu - Purdue University - */ - -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/GeometrySurface/interface/BoundCylinder.h" -#include "TrackingTools/DetLayers/interface/DetLayer.h" -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class DirectMTDNavigation { -public: - /* Constructor */ - DirectMTDNavigation(const edm::ESHandle&); - - DirectMTDNavigation(const edm::ESHandle&, const edm::ParameterSet&); - - DirectMTDNavigation* clone() const { return new DirectMTDNavigation(*this); } - - /* Destructor */ - ~DirectMTDNavigation() {} - - std::vector compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection timeDirection) const; - - std::vector compatibleEndcapLayers(const FreeTrajectoryState& fts, - PropagationDirection timeDirection) const; - -private: - void inOutBarrel(const FreeTrajectoryState&, std::vector&) const; - void outInBarrel(const FreeTrajectoryState&, std::vector&) const; - - void inOutForward(const FreeTrajectoryState&, std::vector&) const; - void outInForward(const FreeTrajectoryState&, std::vector&) const; - - void inOutBackward(const FreeTrajectoryState&, std::vector&) const; - void outInBackward(const FreeTrajectoryState&, std::vector&) const; - - bool checkCompatible(const FreeTrajectoryState& fts, const BarrelDetLayer*) const; - bool checkCompatible(const FreeTrajectoryState& fts, const ForwardDetLayer*) const; - bool outward(const FreeTrajectoryState& fts) const; - - edm::ESHandle theMTDDetLayerGeometry; - float epsilon_; - bool theEndcapFlag; - bool theBarrelFlag; -}; -#endif diff --git a/RecoMTD/Navigation/interface/ETLNavigableLayer.h b/RecoMTD/Navigation/interface/ETLNavigableLayer.h deleted file mode 100644 index d3fe84941c398..0000000000000 --- a/RecoMTD/Navigation/interface/ETLNavigableLayer.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef Navigation_ETLNavigableLayer_H -#define Navigation_ETLNavigableLayer_H - -/** \class ETLNavigableLayer - * - * Navigable layer for Forward Muon - * - * - * \author : Stefano Lacaprara - INFN Padova - * - * Modification: - * Chang Liu: - * compatibleLayers(dir) and compatibleLayers(fts, dir) are added, - * which return ALL DetLayers that are compatible with a given DetLayer. - */ - -/* Collaborating Class Declarations */ -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" - -class DetLayer; -class ForwardDetLayer; - -/* Base Class Headers */ -#include "RecoMTD/Navigation/interface/MTDNavigableLayer.h" - -/* C++ Headers */ - -/* ====================================================================== */ - -/* Class ETLNavigableLayer Interface */ - -class ETLNavigableLayer : public MTDNavigableLayer { -public: - ETLNavigableLayer(const ForwardDetLayer* fdl, - const MapB& innerBarrel, - const MapE& outerEndcap, - const MapE& innerEndcap, - const MapB& allInnerBarrel, - const MapE& allOuterEndcap, - const MapE& allInnerEndcap) - : theDetLayer(fdl), - theInnerBarrelLayers(innerBarrel), - theOuterEndcapLayers(outerEndcap), - theInnerEndcapLayers(innerEndcap), - theAllInnerBarrelLayers(allInnerBarrel), - theAllOuterEndcapLayers(allOuterEndcap), - theAllInnerEndcapLayers(allInnerEndcap) {} - - /// Constructor with outer layers only - ETLNavigableLayer(const ForwardDetLayer* fdl, const MapE& outerEndcap) - : theDetLayer(fdl), theOuterEndcapLayers(outerEndcap) {} - /// Constructor with all outer layers only - ETLNavigableLayer(const ForwardDetLayer* fdl, const MapE& outerEndcap, const MapE& allOuterEndcap) - : theDetLayer(fdl), theOuterEndcapLayers(outerEndcap), theAllOuterEndcapLayers(allOuterEndcap) {} - - /// NavigableLayer interface - std::vector nextLayers(NavigationDirection dir) const override; - - /// NavigableLayer interface - std::vector nextLayers(const FreeTrajectoryState& fts, PropagationDirection dir) const override; - - std::vector compatibleLayers(NavigationDirection dir) const override; - - /// NavigableLayer interface - std::vector compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const override; - /// return DetLayer - const DetLayer* detLayer() const override; - - /// set DetLayer - void setDetLayer(const DetLayer*) override; - - /// Operations - MapE getOuterEndcapLayers() const { return theOuterEndcapLayers; } - MapE getInnerEndcapLayers() const { return theInnerEndcapLayers; } - MapB getInnerBarrelLayers() const { return theInnerBarrelLayers; } - - MapE getAllOuterEndcapLayers() const { return theAllOuterEndcapLayers; } - MapE getAllInnerEndcapLayers() const { return theAllInnerEndcapLayers; } - MapB getAllInnerBarrelLayers() const { return theAllInnerBarrelLayers; } - - /// set inward links - void setInwardLinks(const MapB&, const MapE&); - void setInwardCompatibleLinks(const MapB&, const MapE&); - -private: - void pushResult(std::vector& result, const MapB& map) const; - - void pushResult(std::vector& result, const MapE& map) const; - - void pushResult(std::vector& result, const MapB& map, const FreeTrajectoryState& fts) const; - - void pushResult(std::vector& result, const MapE& map, const FreeTrajectoryState& fts) const; - - void pushCompatibleResult(std::vector& result, - const MapB& map, - const FreeTrajectoryState& fts) const; - - void pushCompatibleResult(std::vector& result, - const MapE& map, - const FreeTrajectoryState& fts) const; - -private: - const ForwardDetLayer* theDetLayer; - MapB theInnerBarrelLayers; - MapE theOuterEndcapLayers; - MapE theInnerEndcapLayers; - MapB theAllInnerBarrelLayers; - MapE theAllOuterEndcapLayers; - MapE theAllInnerEndcapLayers; -}; -#endif diff --git a/RecoMTD/Navigation/interface/MTDDetLayerMap.h b/RecoMTD/Navigation/interface/MTDDetLayerMap.h deleted file mode 100644 index d3859da1fa1c8..0000000000000 --- a/RecoMTD/Navigation/interface/MTDDetLayerMap.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef MTDDetLayerMap_h -#define MTDDetLayerMap_h - -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" - -#include -#include - -/** \class MTDDetLayerComp - * - * Sort the of BarrelDetLayers by radius, ForwardDetLayer by |Z|. - * - * \author : L. Gray - * - * Adapted from MuonDetLayerComp - * - */ - -struct MTDDetLayerComp { - bool operator()(const BarrelDetLayer* l1, const BarrelDetLayer* l2) const { - if (l1->specificSurface().radius() < l2->specificSurface().radius()) - return true; - return false; - } - - bool operator()(const ForwardDetLayer* l1, const ForwardDetLayer* l2) const { - if (fabs(l1->surface().position().z()) < fabs(l2->surface().position().z())) - return true; - return false; - } -}; - -// FIXME: these names are too generic... -typedef std::map MapB; -typedef std::map MapE; -typedef MapB::const_iterator MapBI; -typedef MapE::const_iterator MapEI; - -#endif diff --git a/RecoMTD/Navigation/interface/MTDEtaRange.h b/RecoMTD/Navigation/interface/MTDEtaRange.h deleted file mode 100644 index 3bba0191aecfe..0000000000000 --- a/RecoMTD/Navigation/interface/MTDEtaRange.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef Navigation_MTDEtaRange_H -#define Navigation_MTDEtaRange_H - -/** \class MTDEtaRange - * - * a class to define eta range used in Muon Navigation - * - * - * \author : Stefano Lacaprara - INFN Padova - * - * Modification: - * - */ - -class MTDEtaRange { -public: - MTDEtaRange(); - MTDEtaRange(float max, float min); - MTDEtaRange(const MTDEtaRange&); - ~MTDEtaRange() {} - MTDEtaRange& operator=(const MTDEtaRange&); - inline float min() const { return theMin; } - inline float max() const { return theMax; } - bool isInside(float eta, float error = 0.) const; - bool isInside(const MTDEtaRange& range) const; - bool isCompatible(const MTDEtaRange& range) const; - MTDEtaRange add(const MTDEtaRange&) const; - MTDEtaRange minRange(const MTDEtaRange&) const; - MTDEtaRange subtract(const MTDEtaRange&) const; - -private: - float theMin; - float theMax; -}; -#include -inline std::ostream& operator<<(std::ostream& os, const MTDEtaRange& range) { - os << "(" << range.min() << " : " << range.max() << ")"; - return os; -} - -#endif diff --git a/RecoMTD/Navigation/interface/MTDNavigableLayer.h b/RecoMTD/Navigation/interface/MTDNavigableLayer.h deleted file mode 100644 index 95f41f4c2e48f..0000000000000 --- a/RecoMTD/Navigation/interface/MTDNavigableLayer.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef Navigation_MTDNavigableLayer_H -#define Navigation_MTDNavigableLayer_H - -/** \class MTDNavigableLayer - * - * base class for BTLNavigableLayer and ETLNavigableLayer. - * trackingRange defines an MTDEtaRange for an FTS, - * which is used for search compatible DetLayers. - * - * - * \author : L. Gray - FNAL - * - * Modification: - * - */ - -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" - -class DetLayer; -class BarrelDetLayer; - -#include "TrackingTools/DetLayers/interface/NavigableLayer.h" - -class MTDNavigableLayer : public NavigableLayer { -public: - /// NavigableLayer interface - std::vector nextLayers(NavigationDirection dir) const override = 0; - - /// NavigableLayer interface - std::vector nextLayers(const FreeTrajectoryState& fts, PropagationDirection dir) const override = 0; - - std::vector compatibleLayers(NavigationDirection dir) const override = 0; - - /// NavigableLayer interface - std::vector compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const override = 0; - - /// return DetLayer - const DetLayer* detLayer() const override = 0; - - /// set DetLayer - void setDetLayer(const DetLayer*) override = 0; - - MTDEtaRange trackingRange(const FreeTrajectoryState& fts) const; - - bool isInsideOut(const FreeTrajectoryState& fts) const; -}; -#endif diff --git a/RecoMTD/Navigation/interface/MTDNavigationPrinter.h b/RecoMTD/Navigation/interface/MTDNavigationPrinter.h deleted file mode 100644 index cfb45339c4548..0000000000000 --- a/RecoMTD/Navigation/interface/MTDNavigationPrinter.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef Navigation_MTDNavigationPrinter_H -#define Navigation_MTDNavigationPrinter_H - -/** \class MTDNavigationPrinter - * - * Description: - * class to print the MTDNavigationSchool - * - * - * \author : L. Gray - FNAL - * - */ - -class DetLayer; -class MTDDetLayerGeometry; -class GeometricSearchTracker; -class MTDNavigationSchool; - -#include -#include - -class MTDNavigationPrinter { -public: - MTDNavigationPrinter(const MTDDetLayerGeometry *, - MTDNavigationSchool const &, - bool enableBTL = true, - bool enableETL = true); - MTDNavigationPrinter(const MTDDetLayerGeometry *, MTDNavigationSchool const &, const GeometricSearchTracker *); - -private: - void printLayer(const DetLayer *) const; - void printLayers(const std::vector &) const; - /// return detector part (barrel, forward, backward) - // std::string layerPart(const DetLayer*) const; - /// return detector module (pixel, silicon, msgc, dt, csc, rpc) - // std::string layerModule(const DetLayer*) const; - - MTDNavigationSchool const *school = nullptr; -}; -#endif diff --git a/RecoMTD/Navigation/interface/MTDNavigationSchool.h b/RecoMTD/Navigation/interface/MTDNavigationSchool.h deleted file mode 100644 index a137f3fd0ec8e..0000000000000 --- a/RecoMTD/Navigation/interface/MTDNavigationSchool.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef Navigation_MTDNavigationSchool_H -#define Navigation_MTDNavigationSchool_H - -/** \class MTDNavigationSchool - * - * Description: - * Navigation school for the MTD system - * This class defines which DetLayers are reacheable from each MTD DetLayer - * ( BTL and ETL ). The reacheableness is based on an eta range criteria. - * - * - * \author : L. Gray - * - * Modification: - * - - */ - -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "TrackingTools/DetLayers/interface/NavigationSchool.h" -#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include -#include - -class BTLNavigableLayer; -class ETLNavigableLayer; -class MTDEtaRange; -class BarrelDetLayer; -class ForwardDetLayer; - -class MTDNavigationSchool : public NavigationSchool { -public: - ///Constructor - MTDNavigationSchool(const MTDDetLayerGeometry*, bool enableBTL = true, bool enableETL = true); - /// Destructor - ~MTDNavigationSchool() override; - /// return navigable layers, from base class - StateType navigableLayers() override; - -private: - /// add barrel layer - void addBarrelLayer(const BarrelDetLayer*); - /// add endcap layer (backward and forward) - void addEndcapLayer(const ForwardDetLayer*); - /// link barrel layers - void linkBarrelLayers(); - /// link endcap layers - void linkEndcapLayers(const MapE&, std::vector&); - /// establish inward links - void createInverseLinks(); - float calculateEta(const float&, const float&) const; - -private: - struct delete_layer { - template - void operator()(T*& p) { - if (p) { - delete p; - p = nullptr; - } - } - }; - - MapB theBarrelLayers; /// barrel - MapE theForwardLayers; /// +z endcap - MapE theBackwardLayers; /// -z endcap - - std::vector theBarrelNLC; - std::vector theForwardNLC; - std::vector theBackwardNLC; - - const MTDDetLayerGeometry* theMTDDetLayerGeometry; -}; -#endif diff --git a/RecoMTD/Navigation/src/BTLNavigableLayer.cc b/RecoMTD/Navigation/src/BTLNavigableLayer.cc deleted file mode 100644 index 0105063d350b5..0000000000000 --- a/RecoMTD/Navigation/src/BTLNavigableLayer.cc +++ /dev/null @@ -1,147 +0,0 @@ -/** \class BTLNavigableLayer - * - * Navigable layer for Barrel Timing Layer - * Adapted from MuonBarrelNavigableLayer - * - * - * \author : L. Gray - * - */ - -#include "RecoMTD/Navigation/interface/BTLNavigableLayer.h" - -/* Collaborating Class Header */ -#include "TrackingTools/DetLayers/interface/DetLayer.h" -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" -/* C++ Headers */ -#include - -using namespace std; -std::vector BTLNavigableLayer::nextLayers(NavigationDirection dir) const { - std::vector result; - - if (dir == insideOut) { - pushResult(result, theOuterBarrelLayers); - pushResult(result, theOuterBackwardLayers); - pushResult(result, theOuterForwardLayers); - } else { - pushResult(result, theInnerBarrelLayers); - reverse(result.begin(), result.end()); - pushResult(result, theInnerBackwardLayers); - pushResult(result, theInnerForwardLayers); - } - - result.reserve(result.size()); - return result; -} - -std::vector BTLNavigableLayer::nextLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const { - std::vector result; - - if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) { - pushResult(result, theOuterBarrelLayers, fts); - pushResult(result, theOuterBackwardLayers, fts); - pushResult(result, theOuterForwardLayers, fts); - } else { - pushResult(result, theInnerBarrelLayers, fts); - reverse(result.begin(), result.end()); - pushResult(result, theInnerBackwardLayers, fts); - pushResult(result, theInnerForwardLayers, fts); - } - result.reserve(result.size()); - return result; -} - -std::vector BTLNavigableLayer::compatibleLayers(NavigationDirection dir) const { - std::vector result; - - if (dir == insideOut) { - pushResult(result, theAllOuterBarrelLayers); - pushResult(result, theAllOuterBackwardLayers); - pushResult(result, theAllOuterForwardLayers); - } else { - pushResult(result, theAllInnerBarrelLayers); - reverse(result.begin(), result.end()); - pushResult(result, theAllInnerBackwardLayers); - pushResult(result, theAllInnerForwardLayers); - } - - result.reserve(result.size()); - return result; -} - -std::vector BTLNavigableLayer::compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const { - std::vector result; - - if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) { - pushCompatibleResult(result, theAllOuterBarrelLayers, fts); - pushCompatibleResult(result, theAllOuterBackwardLayers, fts); - pushCompatibleResult(result, theAllOuterForwardLayers, fts); - } else { - pushCompatibleResult(result, theAllInnerBarrelLayers, fts); - reverse(result.begin(), result.end()); - pushCompatibleResult(result, theAllInnerBackwardLayers, fts); - pushCompatibleResult(result, theAllInnerForwardLayers, fts); - } - result.reserve(result.size()); - return result; -} - -void BTLNavigableLayer::pushResult(std::vector& result, const MapB& map) const { - for (MapBI i = map.begin(); i != map.end(); i++) - result.push_back((*i).first); -} - -void BTLNavigableLayer::pushResult(std::vector& result, const MapE& map) const { - for (MapEI i = map.begin(); i != map.end(); i++) - result.push_back((*i).first); -} - -void BTLNavigableLayer::pushResult(std::vector& result, - const MapB& map, - const FreeTrajectoryState& fts) const { - for (MapBI i = map.begin(); i != map.end(); i++) - if ((*i).second.isInside(fts.position().eta())) - result.push_back((*i).first); -} - -void BTLNavigableLayer::pushResult(std::vector& result, - const MapE& map, - const FreeTrajectoryState& fts) const { - for (MapEI i = map.begin(); i != map.end(); i++) - if ((*i).second.isInside(fts.position().eta())) - result.push_back((*i).first); -} - -void BTLNavigableLayer::pushCompatibleResult(std::vector& result, - const MapB& map, - const FreeTrajectoryState& fts) const { - MTDEtaRange range = trackingRange(fts); - for (MapBI i = map.begin(); i != map.end(); i++) - if ((*i).second.isCompatible(range)) - result.push_back((*i).first); -} - -void BTLNavigableLayer::pushCompatibleResult(std::vector& result, - const MapE& map, - const FreeTrajectoryState& fts) const { - MTDEtaRange range = trackingRange(fts); - for (MapEI i = map.begin(); i != map.end(); i++) - if ((*i).second.isCompatible(range)) - result.push_back((*i).first); -} - -const DetLayer* BTLNavigableLayer::detLayer() const { return theDetLayer; } - -void BTLNavigableLayer::setDetLayer(const DetLayer* dl) { - edm::LogError("BTLNavigableLayer") << "BTLNavigableLayer::setDetLayer called!! " << endl; -} - -void BTLNavigableLayer::setInwardLinks(const MapB& innerBL) { theInnerBarrelLayers = innerBL; } -void BTLNavigableLayer::setInwardCompatibleLinks(const MapB& innerCBL) { theAllInnerBarrelLayers = innerCBL; } diff --git a/RecoMTD/Navigation/src/DirectMTDNavigation.cc b/RecoMTD/Navigation/src/DirectMTDNavigation.cc deleted file mode 100644 index 99c0d8ea9a468..0000000000000 --- a/RecoMTD/Navigation/src/DirectMTDNavigation.cc +++ /dev/null @@ -1,254 +0,0 @@ -#include "RecoMTD/Navigation/interface/DirectMTDNavigation.h" - -/** \file DirectMTDNavigation - * - * \author L. Gray - FNAL - */ - -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" -#include "DataFormats/GeometrySurface/interface/BoundCylinder.h" -#include "DataFormats/GeometrySurface/interface/BoundDisk.h" -#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include - -using namespace std; - -DirectMTDNavigation::DirectMTDNavigation(const edm::ESHandle& mtdLayout) - : theMTDDetLayerGeometry(mtdLayout), epsilon_(100.), theEndcapFlag(true), theBarrelFlag(true) {} - -DirectMTDNavigation::DirectMTDNavigation(const edm::ESHandle& mtdLayout, - const edm::ParameterSet& par) - : theMTDDetLayerGeometry(mtdLayout), - epsilon_(100.), - theEndcapFlag(par.getParameter("Endcap")), - theBarrelFlag(par.getParameter("Barrel")) {} - -/* return compatible layers for given trajectory state */ -vector DirectMTDNavigation::compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const { - float z0 = fts.position().z(); - float zm = fts.momentum().z(); - - bool inOut = outward(fts); - - vector output; - - // check direction and position of FTS to get a correct order of DetLayers - - if (inOut) { - if ((zm * z0) >= 0) { - if (theBarrelFlag) - inOutBarrel(fts, output); - if (theEndcapFlag) { - if (z0 >= 0) - inOutForward(fts, output); - else - inOutBackward(fts, output); - } - } else { - if (theEndcapFlag) { - if (z0 >= 0) - outInForward(fts, output); - else - outInBackward(fts, output); - } - if (theBarrelFlag) - inOutBarrel(fts, output); - } - } else { - if ((zm * z0) >= 0) { - if (theBarrelFlag) - outInBarrel(fts, output); - if (theEndcapFlag) { - if (z0 >= 0) - inOutForward(fts, output); - else - inOutBackward(fts, output); - } - } else { - if (theEndcapFlag) { - if (z0 >= 0) - outInForward(fts, output); - else - outInBackward(fts, output); - } - if (theBarrelFlag) - outInBarrel(fts, output); - } - } - - if (dir == oppositeToMomentum) - std::reverse(output.begin(), output.end()); - - return output; -} - -/* -return compatible endcap layers on BOTH ends; -used for beam-halo muons -*/ -vector DirectMTDNavigation::compatibleEndcapLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const { - float zm = fts.momentum().z(); - - vector output; - - // collect all endcap layers on 2 sides - outInBackward(fts, output); - inOutForward(fts, output); - - // check direction FTS to get a correct order of DetLayers - if ((zm > 0 && dir == oppositeToMomentum) || (zm < 0 && dir == alongMomentum)) - std::reverse(output.begin(), output.end()); - - return output; -} - -void DirectMTDNavigation::inOutBarrel(const FreeTrajectoryState& fts, vector& output) const { - bool cont = false; - const vector& barrel = theMTDDetLayerGeometry->allBarrelLayers(); - - for (vector::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++) { - if (cont) - output.push_back((*iter_B)); - else if (checkCompatible(fts, dynamic_cast(*iter_B))) { - output.push_back((*iter_B)); - cont = true; - } - } -} - -void DirectMTDNavigation::outInBarrel(const FreeTrajectoryState& fts, vector& output) const { - // default barrel layers are in out, reverse order - const vector& barrel = theMTDDetLayerGeometry->allBarrelLayers(); - - bool cont = false; - vector::const_iterator rbegin = barrel.end(); - rbegin--; - vector::const_iterator rend = barrel.begin(); - rend--; - - for (vector::const_iterator iter_B = rbegin; iter_B != rend; iter_B--) { - if (cont) - output.push_back((*iter_B)); - else if (checkCompatible(fts, dynamic_cast(*iter_B))) { - output.push_back((*iter_B)); - cont = true; - } - } -} - -void DirectMTDNavigation::inOutForward(const FreeTrajectoryState& fts, vector& output) const { - const vector& forward = theMTDDetLayerGeometry->allForwardLayers(); - bool cont = false; - for (vector::const_iterator iter_E = forward.begin(); iter_E != forward.end(); iter_E++) { - if (cont) - output.push_back((*iter_E)); - else if (checkCompatible(fts, dynamic_cast(*iter_E))) { - output.push_back((*iter_E)); - cont = true; - } - } -} - -void DirectMTDNavigation::outInForward(const FreeTrajectoryState& fts, vector& output) const { - // default forward layers are in out, reverse order - - bool cont = false; - const vector& forward = theMTDDetLayerGeometry->allForwardLayers(); - vector::const_iterator rbegin = forward.end(); - rbegin--; - vector::const_iterator rend = forward.begin(); - rend--; - for (vector::const_iterator iter_E = rbegin; iter_E != rend; iter_E--) { - if (cont) - output.push_back((*iter_E)); - else if (checkCompatible(fts, dynamic_cast(*iter_E))) { - output.push_back((*iter_E)); - cont = true; - } - } -} - -void DirectMTDNavigation::inOutBackward(const FreeTrajectoryState& fts, vector& output) const { - bool cont = false; - const vector& backward = theMTDDetLayerGeometry->allBackwardLayers(); - - for (vector::const_iterator iter_E = backward.begin(); iter_E != backward.end(); iter_E++) { - if (cont) - output.push_back((*iter_E)); - else if (checkCompatible(fts, dynamic_cast(*iter_E))) { - output.push_back((*iter_E)); - cont = true; - } - } -} - -void DirectMTDNavigation::outInBackward(const FreeTrajectoryState& fts, vector& output) const { - bool cont = false; - const vector& backward = theMTDDetLayerGeometry->allBackwardLayers(); - - vector::const_iterator rbegin = backward.end(); - rbegin--; - vector::const_iterator rend = backward.begin(); - rend--; - for (vector::const_iterator iter_E = rbegin; iter_E != rend; iter_E--) { - if (cont) - output.push_back((*iter_E)); - else if (checkCompatible(fts, dynamic_cast(*iter_E))) { - output.push_back((*iter_E)); - cont = true; - } - } -} - -bool DirectMTDNavigation::checkCompatible(const FreeTrajectoryState& fts, const BarrelDetLayer* dl) const { - float z0 = fts.position().z(); - float r0 = fts.position().perp(); - float zm = fts.momentum().z(); - float rm = fts.momentum().perp(); - float slope = zm / rm; - if (!outward(fts)) - slope = -slope; - const BoundCylinder& bc = dl->specificSurface(); - float radius = bc.radius(); - float length = bc.bounds().length() / 2.; - - float z1 = slope * (radius - r0) + z0; - return (fabs(z1) <= fabs(length) + epsilon_); -} - -bool DirectMTDNavigation::checkCompatible(const FreeTrajectoryState& fts, const ForwardDetLayer* dl) const { - float z0 = fts.position().z(); - float r0 = fts.position().perp(); - float zm = fts.momentum().z(); - float rm = fts.momentum().perp(); - float slope = rm / zm; - - if (!outward(fts)) - slope = -slope; - - const BoundDisk& bd = dl->specificSurface(); - - float outRadius = bd.outerRadius(); - float inRadius = bd.innerRadius(); - float z = bd.position().z(); - - float r1 = slope * (z - z0) + r0; - return (r1 >= inRadius - epsilon_ && r1 <= outRadius + epsilon_); -} - -bool DirectMTDNavigation::outward(const FreeTrajectoryState& fts) const { - // return (fts.position().basicVector().dot(fts.momentum().basicVector())>0); - - float x0 = fts.position().x(); - float y0 = fts.position().y(); - - float xm = fts.momentum().x(); - float ym = fts.momentum().y(); - - return ((x0 * xm + y0 * ym) > 0); -} diff --git a/RecoMTD/Navigation/src/ETLNavigableLayer.cc b/RecoMTD/Navigation/src/ETLNavigableLayer.cc deleted file mode 100644 index f6ec5e583d263..0000000000000 --- a/RecoMTD/Navigation/src/ETLNavigableLayer.cc +++ /dev/null @@ -1,151 +0,0 @@ -/** \class ETLNavigableLayer - * - * Navigable layer for ETL - * - * - * \author : L. Gray - FNAL - * - * - * Adapted from ETLNavigableLayer - */ - -#include "RecoMTD/Navigation/interface/ETLNavigableLayer.h" - -/* Collaborating Class Header */ -#include "TrackingTools/DetLayers/interface/DetLayer.h" -#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include - -using namespace std; -using namespace edm; - -vector ETLNavigableLayer::nextLayers(NavigationDirection dir) const { - vector result; - vector barrel; - - if (dir == insideOut) { - pushResult(result, theOuterEndcapLayers); - } else { - pushResult(result, theInnerEndcapLayers); - reverse(result.begin(), result.end()); - pushResult(barrel, theInnerBarrelLayers); - reverse(barrel.begin(), barrel.end()); - result.insert(result.end(), barrel.begin(), barrel.end()); - } - - result.reserve(result.size()); - return result; -} - -vector ETLNavigableLayer::nextLayers(const FreeTrajectoryState& fts, PropagationDirection dir) const { - vector result; - vector barrel; - - if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) { - pushResult(result, theOuterEndcapLayers, fts); - } else { - pushResult(result, theInnerEndcapLayers, fts); - reverse(result.begin(), result.end()); - pushResult(barrel, theInnerBarrelLayers, fts); - reverse(barrel.begin(), barrel.end()); - result.insert(result.end(), barrel.begin(), barrel.end()); - } - - result.reserve(result.size()); - return result; -} - -vector ETLNavigableLayer::compatibleLayers(NavigationDirection dir) const { - vector result; - vector barrel; - - if (dir == insideOut) { - pushResult(result, theAllOuterEndcapLayers); - } else { - pushResult(result, theAllInnerEndcapLayers); - reverse(result.begin(), result.end()); - pushResult(barrel, theAllInnerBarrelLayers); - reverse(barrel.begin(), barrel.end()); - result.insert(result.end(), barrel.begin(), barrel.end()); - } - - result.reserve(result.size()); - return result; -} -vector ETLNavigableLayer::compatibleLayers(const FreeTrajectoryState& fts, - PropagationDirection dir) const { - vector result; - vector barrel; - - if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) { - pushCompatibleResult(result, theAllOuterEndcapLayers, fts); - } else { - pushCompatibleResult(result, theAllInnerEndcapLayers, fts); - reverse(result.begin(), result.end()); - pushCompatibleResult(barrel, theAllInnerBarrelLayers, fts); - reverse(barrel.begin(), barrel.end()); - result.insert(result.end(), barrel.begin(), barrel.end()); - } - result.reserve(result.size()); - return result; -} - -void ETLNavigableLayer::pushResult(vector& result, const MapB& map) const { - for (MapBI i = map.begin(); i != map.end(); i++) - result.push_back((*i).first); -} - -void ETLNavigableLayer::pushResult(vector& result, const MapE& map) const { - for (MapEI i = map.begin(); i != map.end(); i++) - result.push_back((*i).first); -} - -void ETLNavigableLayer::pushResult(vector& result, - const MapE& map, - const FreeTrajectoryState& fts) const { - for (MapEI i = map.begin(); i != map.end(); i++) - if ((*i).second.isInside(fts.position().eta())) - result.push_back((*i).first); -} - -void ETLNavigableLayer::pushResult(vector& result, - const MapB& map, - const FreeTrajectoryState& fts) const { - for (MapBI i = map.begin(); i != map.end(); i++) - if ((*i).second.isInside(fts.position().eta())) - result.push_back((*i).first); -} - -void ETLNavigableLayer::pushCompatibleResult(vector& result, - const MapB& map, - const FreeTrajectoryState& fts) const { - MTDEtaRange range = trackingRange(fts); - for (MapBI i = map.begin(); i != map.end(); i++) - if ((*i).second.isCompatible(range)) - result.push_back((*i).first); -} - -void ETLNavigableLayer::pushCompatibleResult(vector& result, - const MapE& map, - const FreeTrajectoryState& fts) const { - MTDEtaRange range = trackingRange(fts); - for (MapEI i = map.begin(); i != map.end(); i++) - if ((*i).second.isCompatible(range)) - result.push_back((*i).first); -} - -const DetLayer* ETLNavigableLayer::detLayer() const { return theDetLayer; } - -void ETLNavigableLayer::setDetLayer(const DetLayer* dl) { - edm::LogError("ETLNavigablaLayer") << "ETLNavigableLayer::setDetLayer called!! " << endl; -} - -void ETLNavigableLayer::setInwardLinks(const MapB& innerBL, const MapE& innerEL) { - theInnerBarrelLayers = innerBL; - theInnerEndcapLayers = innerEL; -} -void ETLNavigableLayer::setInwardCompatibleLinks(const MapB& innerCBL, const MapE& innerCEL) { - theAllInnerBarrelLayers = innerCBL; - theAllInnerEndcapLayers = innerCEL; -} diff --git a/RecoMTD/Navigation/src/MTDEtaRange.cc b/RecoMTD/Navigation/src/MTDEtaRange.cc deleted file mode 100644 index 53a71b49ce196..0000000000000 --- a/RecoMTD/Navigation/src/MTDEtaRange.cc +++ /dev/null @@ -1,76 +0,0 @@ -/** \class MTDEtaRange - * - * a class to define eta range used in MTD Navigation - * - * - * \author : L. Gray - FNAL - * - * Modification: - * - */ - -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include - -MTDEtaRange::MTDEtaRange() : theMin(0), theMax(0) {} - -MTDEtaRange::MTDEtaRange(float max, float min) { - if (max < min) { - edm::LogWarning("MTDEtaRange") << "Warning MTDEtaRange:: max < min!! correcting" << std::endl; - float tmp(min); - min = max; - max = tmp; - } - theMax = max; - theMin = min; -} - -MTDEtaRange::MTDEtaRange(const MTDEtaRange& range) : theMin(range.theMin), theMax(range.theMax) {} -/// Assignment operator -MTDEtaRange& MTDEtaRange::operator=(const MTDEtaRange& range) { - if (this != &range) { - theMin = range.theMin; - theMax = range.theMax; - } - return *this; -} - -bool MTDEtaRange::isInside(float eta, float error) const { - if ((eta + error) > max() || (eta - error) < min()) - return false; - return true; -} -/// true if this is completely inside range -bool MTDEtaRange::isInside(const MTDEtaRange& range) const { - if (min() > range.min() && max() < range.max()) - return true; - return false; -} -/// true if this overlaps with range -bool MTDEtaRange::isCompatible(const MTDEtaRange& range) const { - if (range.min() > max() || range.max() < min()) - return false; - return true; -} -/// create maximum of ranges -MTDEtaRange MTDEtaRange::add(const MTDEtaRange& range) const { - float max = (theMax > range.theMax) ? theMax : range.theMax; - float min = (theMin < range.theMin) ? theMin : range.theMin; - return MTDEtaRange(max, min); -} -/// create new range of size this minus range -MTDEtaRange MTDEtaRange::subtract(const MTDEtaRange& range) const { - if (range.isInside(*this)) { - edm::LogInfo("MTDEtaRange") << "MTDEtaRange: range is inside!" << std::endl; - return *this; - } - if (!range.isCompatible(*this)) { - edm::LogInfo("MTDEtaRange") << "MTDEtaRange: no overlap between ranges" << std::endl; - return *this; - } - - float max = isInside(range.theMin) ? range.theMin : theMax; - float min = isInside(range.theMax) ? range.theMax : theMin; - return MTDEtaRange(max, min); -} diff --git a/RecoMTD/Navigation/src/MTDNavigableLayer.cc b/RecoMTD/Navigation/src/MTDNavigableLayer.cc deleted file mode 100644 index 3eee6f70336c7..0000000000000 --- a/RecoMTD/Navigation/src/MTDNavigableLayer.cc +++ /dev/null @@ -1,78 +0,0 @@ -/** \class MTDNavigableLayer - * - * base class for MTDNavigableLayer and MuonForwardNavigableLayer. - * trackingRange defines an MTDEtaRange for an FTS, - * which is used for searching compatible DetLayers. - * - * - * \author : Chang Liu - Purdue University - * with contributions from: R. Bellan - INFN Torino - * - * code of trackingRange is from MuonGlobalNavigation in ORCA - * whose author is Stefano Lacaprara - INFN Padova - * Modification: - * - */ - -#include "RecoMTD/Navigation/interface/MTDNavigableLayer.h" - -/* Collaborating Class Header */ -#include "TrackingTools/DetLayers/interface/DetLayer.h" -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -/* C++ Headers */ -#include - -using namespace std; - -extern float calculateEta(float r, float z) { - if (z > 0) - return -log((tan(atan(r / z) / 2.))); - return log(-(tan(atan(r / z) / 2.))); -} - -MTDEtaRange MTDNavigableLayer::trackingRange(const FreeTrajectoryState& fts) const { - float z = fts.position().z(); - float r = fts.position().perp(); - float eta; - if (z > 0) - eta = -log((tan(atan(r / z) / 2.))); - else - eta = log(-(tan(atan(r / z) / 2.))); - - double theta = atan(r / z); - - double spread = 5.0 * sqrt(fts.curvilinearError().matrix()(2, 2)) / fabs(sin(theta)); //5*sigma(eta) - - //C.L.: this spread could be too large to use. - // convert it to a smaller one by assuming a virtual radius - // that transforms the error on angle to error on z axis. - // not accurate, but works! - - double eta_max = 0; - - if (z > 0) - eta_max = calculateEta(r, z + spread); - else - eta_max = calculateEta(r, z - spread); - - spread = std::min(0.07, fabs(eta_max - eta)); - - MTDEtaRange range(eta + spread, eta - spread); - - spread = 0.07; - // special treatment for special geometry in overlap region - - if (eta > 1.0 && eta < 1.1) - range = MTDEtaRange(eta + 3.0 * spread, eta - spread); - if (eta < -1.0 && eta > -1.1) - range = MTDEtaRange(eta + spread, eta - 3.0 * spread); - - return range; -} - -bool MTDNavigableLayer::isInsideOut(const FreeTrajectoryState& fts) const { - return (fts.position().basicVector().dot(fts.momentum().basicVector()) > 0); -} diff --git a/RecoMTD/Navigation/src/MTDNavigationPrinter.cc b/RecoMTD/Navigation/src/MTDNavigationPrinter.cc deleted file mode 100644 index c3360120a0928..0000000000000 --- a/RecoMTD/Navigation/src/MTDNavigationPrinter.cc +++ /dev/null @@ -1,176 +0,0 @@ -/** \class MTDNavigationPrinter - * - * Description: - * class to print the MTDNavigationSchool - * - * - * \author : L. Gray - FNAL - * - */ - -#include "RecoMTD/Navigation/interface/MTDNavigationPrinter.h" - -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" -#include "DataFormats/GeometrySurface/interface/BoundCylinder.h" -#include "DataFormats/GeometrySurface/interface/BoundDisk.h" -#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h" -#include "RecoMTD/Navigation/interface/MTDNavigationSchool.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -using namespace std; - -// #define VI_DEBUG - -#ifdef VI_DEBUG -#define PRINT(x) std::cout << x << ' ' -#else -#define PRINT(x) edm::LogInfo(x) -#endif - -MTDNavigationPrinter::MTDNavigationPrinter(const MTDDetLayerGeometry* mtdLayout, - MTDNavigationSchool const& sh, - bool enableBTL, - bool enableETL) - : school(&sh) { - PRINT("MTDNavigationPrinter") << "MTDNavigationPrinter::MTDNavigationPrinter" << std::endl; - PRINT("MTDNavigationPrinter") << "================================" << std::endl; - PRINT("MTDNavigationPrinter") << "BARREL:" << std::endl; - vector barrel; - if (enableBTL) - barrel = mtdLayout->allBarrelLayers(); - else - barrel = mtdLayout->allBarrelLayers(); - - PRINT("MTDNavigationPrinter") << "There are " << barrel.size() << " Barrel DetLayers"; - for (auto i : barrel) - printLayer(i); - PRINT("MTDNavigationPrinter") << "================================" << std::endl; - PRINT("MTDNavigationPrinter") << "BACKWARD:" << std::endl; - - vector backward; - - if (enableETL) - backward = mtdLayout->allBackwardLayers(); - else - backward = mtdLayout->allBackwardLayers(); - - PRINT("MTDNavigationPrinter") << "There are " << backward.size() << " Backward DetLayers"; - for (auto i : backward) - printLayer(i); - PRINT("MTDNavigationPrinter") << "==============================" << std::endl; - PRINT("MTDNavigationPrinter") << "FORWARD:" << std::endl; - vector forward; - - if (enableETL) - forward = mtdLayout->allForwardLayers(); - else - forward = mtdLayout->allForwardLayers(); - - PRINT("MTDNavigationPrinter") << "There are " << forward.size() << " Forward DetLayers" << std::endl; - for (auto i : forward) - printLayer(i); -} - -MTDNavigationPrinter::MTDNavigationPrinter(const MTDDetLayerGeometry* mtdLayout, - MTDNavigationSchool const& sh, - const GeometricSearchTracker* tracker) - : school(&sh) { - PRINT("MTDNavigationPrinter") << "MTDNavigationPrinter::MTDNavigationPrinter" << std::endl; - // vector::const_iterator tkiter; - // vector::const_iterator tkfiter; - PRINT("MTDNavigationPrinter") << "================================" << std::endl; - PRINT("MTDNavigationPrinter") << "BARREL:" << std::endl; - const vector& tkbarrel = tracker->barrelLayers(); - PRINT("MTDNavigationPrinter") << "There are " << tkbarrel.size() << " Tk Barrel DetLayers" << std::endl; - // for ( tkiter = tkbarrel.begin(); tkiter != tkbarrel.end(); tkiter++ ) printLayer(*tkiter); - vector barrel = mtdLayout->allBarrelLayers(); - PRINT("MTDNavigationPrinter") << "There are " << barrel.size() << " Mu Barrel DetLayers"; - for (auto i : barrel) - printLayer(i); - PRINT("MTDNavigationPrinter") << "================================" << std::endl; - PRINT("MTDNavigationPrinter") << "BACKWARD:" << std::endl; - const vector& tkbackward = tracker->negForwardLayers(); - PRINT("MTDNavigationPrinter") << "There are " << tkbackward.size() << " Tk Backward DetLayers" << std::endl; - /// for ( tkfiter = tkbackward.begin(); tkfiter != tkbackward.end(); tkfiter++ ) printLayer(*tkfiter); - vector backward = mtdLayout->allBackwardLayers(); - PRINT("MTDNavigationPrinter") << "There are " << backward.size() << " Mu Backward DetLayers << std::endl"; - for (auto i : backward) - printLayer(i); - PRINT("MTDNavigationPrinter") << "==============================" << std::endl; - PRINT("MTDNavigationPrinter") << "FORWARD:" << std::endl; - const vector& tkforward = tracker->posForwardLayers(); - PRINT("MTDNavigationPrinter") << "There are " << tkforward.size() << " Tk Forward DetLayers" << std::endl; - // for ( tkfiter = tkforward.begin(); tkfiter != tkforward.end(); tkfiter++ ) printLayer(*tkfiter); - - vector forward = mtdLayout->allForwardLayers(); - PRINT("MTDNavigationPrinter") << "There are " << forward.size() << " Mu Forward DetLayers"; - for (auto i : forward) - printLayer(i); -} - -/// print layer -void MTDNavigationPrinter::printLayer(const DetLayer* layer) const { - vector nextLayers = school->nextLayers(*layer, insideOut); - vector compatibleLayers = school->compatibleLayers(*layer, insideOut); - if (const BarrelDetLayer* bdl = dynamic_cast(layer)) { - PRINT("MTDNavigationPrinter") << layer->location() << " " << layer->subDetector() - << " layer at R: " << setiosflags(ios::showpoint | ios::fixed) << setw(8) - << setprecision(2) << bdl->specificSurface().radius() << " length: " << setw(6) - << setprecision(2) << layer->surface().bounds().length() << std::endl; - - } else if (const ForwardDetLayer* fdl = dynamic_cast(layer)) { - PRINT("MTDNavigationPrinter") << endl - << layer->location() << " " << layer->subDetector() - << "layer at z: " << setiosflags(ios::showpoint | ios::fixed) << setw(8) - << setprecision(2) << layer->surface().position().z() << " inner r: " << setw(6) - << setprecision(2) << fdl->specificSurface().innerRadius() << " outer r: " << setw(6) - << setprecision(2) << fdl->specificSurface().outerRadius() << std::endl; - } - PRINT("MTDNavigationPrinter") << " has " << nextLayers.size() - << " next layers in the direction inside-out: " << std::endl; - printLayers(nextLayers); - - nextLayers.clear(); - nextLayers = school->nextLayers(*layer, outsideIn); - - PRINT("MTDNavigationPrinter") << " has " << nextLayers.size() - << " next layers in the direction outside-in: " << std::endl; - printLayers(nextLayers); - - PRINT("MTDNavigationPrinter") << " has " << compatibleLayers.size() - << " compatible layers in the direction inside-out:: " << std::endl; - printLayers(compatibleLayers); - compatibleLayers.clear(); - compatibleLayers = school->compatibleLayers(*layer, outsideIn); - - PRINT("MTDNavigationPrinter") << " has " << compatibleLayers.size() - << " compatible layers in the direction outside-in: " << std::endl; - printLayers(compatibleLayers); -} - -/// print next layers -void MTDNavigationPrinter::printLayers(const vector& nextLayers) const { - for (vector::const_iterator inext = nextLayers.begin(); inext != nextLayers.end(); inext++) { - PRINT("MTDNavigationPrinter") << " --> " << std::endl; - if ((*inext)->location() == GeomDetEnumerators::barrel) { - const BarrelDetLayer* l = dynamic_cast(&(**inext)); - PRINT("MTDNavigationPrinter") << (*inext)->location() << " " << (*inext)->subDetector() - << " layer at R: " << setiosflags(ios::showpoint | ios::fixed) << setw(8) - << setprecision(2) << l->specificSurface().radius() << " " << std::endl; - } else { - const ForwardDetLayer* l = dynamic_cast(&(**inext)); - PRINT("MTDNavigationPrinter") << (*inext)->location() << " " << (*inext)->subDetector() - << " layer at z: " << setiosflags(ios::showpoint | ios::fixed) << setw(8) - << setprecision(2) << l->surface().position().z() << " " << std::endl; - } - PRINT("MTDNavigationPrinter") << setiosflags(ios::showpoint | ios::fixed) << setprecision(1) << setw(6) - << (*inext)->surface().bounds().length() << ", " << setw(6) - << (*inext)->surface().bounds().width() << ", " << setw(4) - << (*inext)->surface().bounds().thickness() << " : " << (*inext)->surface().position() - << std::endl; - } -} diff --git a/RecoMTD/Navigation/src/MTDNavigationSchool.cc b/RecoMTD/Navigation/src/MTDNavigationSchool.cc deleted file mode 100644 index 9dd4fbac6ba6c..0000000000000 --- a/RecoMTD/Navigation/src/MTDNavigationSchool.cc +++ /dev/null @@ -1,334 +0,0 @@ -/** \class MTDNavigationSchool - * - * Description: - * Navigation school for the MTD system - * This class defines which DetLayers are reacheable from each MTD DetLayer - * (BTL and ETL). The reacheableness is based on an eta range criteria. - * - * - * \author : L. Gray - FNAL - * - * Modification: - * - */ - -#include "RecoMTD/Navigation/interface/MTDNavigationSchool.h" - -/* Collaborating Class Header */ -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" -#include "DataFormats/GeometrySurface/interface/BoundCylinder.h" -#include "DataFormats/GeometrySurface/interface/BoundDisk.h" -#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include "RecoMTD/Navigation/interface/BTLNavigableLayer.h" -#include "RecoMTD/Navigation/interface/ETLNavigableLayer.h" -#include "RecoMTD/Navigation/interface/MTDEtaRange.h" -#include "RecoMTD/Navigation/interface/MTDDetLayerMap.h" -#include "FWCore/Utilities/interface/Exception.h" - -#include -#include -using namespace std; - -/// Constructor -MTDNavigationSchool::MTDNavigationSchool(const MTDDetLayerGeometry* mtdLayout, bool enableBTL, bool enableETL) - : theMTDDetLayerGeometry(mtdLayout) { - theAllDetLayersInSystem = &mtdLayout->allLayers(); - theAllNavigableLayer.resize(mtdLayout->allLayers().size(), nullptr); - - // get all barrel DetLayers (BTL) - vector barrel; - if (enableBTL) - barrel = mtdLayout->allBarrelLayers(); - else - barrel = mtdLayout->allBarrelLayers(); - - for (auto i = barrel.begin(); i != barrel.end(); i++) { - const BarrelDetLayer* mbp = dynamic_cast(*i); - if (mbp == nullptr) - throw cms::Exception("MTDNavigationSchool", "Bad BarrelDetLayer"); - addBarrelLayer(mbp); - } - - // get all endcap DetLayers (ETL) - vector endcap; - if (enableETL) - endcap = mtdLayout->allEndcapLayers(); - else - endcap = mtdLayout->allEndcapLayers(); - - for (auto i = endcap.begin(); i != endcap.end(); i++) { - const ForwardDetLayer* mep = dynamic_cast(*i); - if (mep == nullptr) - throw cms::Exception("MTDNavigationSchool", "Bad ForwardDetLayer"); - addEndcapLayer(mep); - } - - // create outward links for all DetLayers - linkBarrelLayers(); - linkEndcapLayers(theForwardLayers, theForwardNLC); - linkEndcapLayers(theBackwardLayers, theBackwardNLC); - - // create inverse links - createInverseLinks(); -} - -/// Destructor -MTDNavigationSchool::~MTDNavigationSchool() { - for_each(theBarrelNLC.begin(), theBarrelNLC.end(), delete_layer()); - for_each(theForwardNLC.begin(), theForwardNLC.end(), delete_layer()); - for_each(theBackwardNLC.begin(), theBackwardNLC.end(), delete_layer()); -} - -/// return all Navigable layers -MTDNavigationSchool::StateType MTDNavigationSchool::navigableLayers() { - StateType result; - - vector::const_iterator ib; - vector::const_iterator ie; - - for (ib = theBarrelNLC.begin(); ib != theBarrelNLC.end(); ib++) { - result.push_back(*ib); - } - - for (ie = theForwardNLC.begin(); ie != theForwardNLC.end(); ie++) { - result.push_back(*ie); - } - - for (ie = theBackwardNLC.begin(); ie != theBackwardNLC.end(); ie++) { - result.push_back(*ie); - } - - return result; -} - -/// create barrel layer map -void MTDNavigationSchool::addBarrelLayer(const BarrelDetLayer* mbp) { - const BoundCylinder& bc = mbp->specificSurface(); - float radius = bc.radius(); - float length = bc.bounds().length() / 2.; - - float eta_max = calculateEta(radius, length); - float eta_min = -eta_max; - - theBarrelLayers[mbp] = MTDEtaRange(eta_max, eta_min); -} - -/// create forwrad/backward layer maps -void MTDNavigationSchool::addEndcapLayer(const ForwardDetLayer* mep) { - const BoundDisk& bd = mep->specificSurface(); - float outRadius = bd.outerRadius(); - float inRadius = bd.innerRadius(); - float thick = bd.bounds().length() / 2.; - float z = bd.position().z(); - - if (z > 0.) { - float eta_min = calculateEta(outRadius, z - thick); - float eta_max = calculateEta(inRadius, z + thick); - theForwardLayers[mep] = MTDEtaRange(eta_max, eta_min); - } else { - float eta_max = calculateEta(outRadius, z + thick); - float eta_min = calculateEta(inRadius, z - thick); - theBackwardLayers[mep] = MTDEtaRange(eta_max, eta_min); - } -} - -/// calculate pseudorapidity from r and z -float MTDNavigationSchool::calculateEta(const float& r, const float& z) const { - if (z > 0) - return -log((tan(atan(r / z) / 2.))); - return log(-(tan(atan(r / z) / 2.))); -} - -/// linking barrel layers outwards -void MTDNavigationSchool::linkBarrelLayers() { - for (MapBI bl = theBarrelLayers.begin(); bl != theBarrelLayers.end(); bl++) { - MTDEtaRange range = (*bl).second; - - // first add next barrel layer - MapBI plusOne(bl); - plusOne++; - MapB outerBarrel; - MapB allOuterBarrel; - if (plusOne != theBarrelLayers.end()) { - outerBarrel.insert(*plusOne); - } - // add all outer barrel layers - for (MapBI iMBI = plusOne; iMBI != theBarrelLayers.end(); iMBI++) { - allOuterBarrel.insert(*iMBI); - } - // then add all compatible backward layers with an eta criteria - MapE allOuterBackward; - for (MapEI el = theBackwardLayers.begin(); el != theBackwardLayers.end(); el++) { - if ((*el).second.isCompatible(range)) { - allOuterBackward.insert(*el); - } - } - //add the backward next layer with an eta criteria - MapE outerBackward; - for (MapEI el = theBackwardLayers.begin(); el != theBackwardLayers.end(); el++) { - if ((*el).second.isCompatible(range)) { - outerBackward.insert(*el); - break; - } - } - - // then add all compatible forward layers with an eta criteria - MapE allOuterForward; - for (MapEI el = theForwardLayers.begin(); el != theForwardLayers.end(); el++) { - if ((*el).second.isCompatible(range)) { - allOuterForward.insert(*el); - } - } - - // then add forward next layer with an eta criteria - MapE outerForward; - for (MapEI el = theForwardLayers.begin(); el != theForwardLayers.end(); el++) { - if ((*el).second.isCompatible(range)) { - outerForward.insert(*el); - break; - } - } - - theBarrelNLC.push_back(new BTLNavigableLayer( - (*bl).first, outerBarrel, outerBackward, outerForward, allOuterBarrel, allOuterBackward, allOuterForward)); - } -} -/// linking forward/backward layers outwards -void MTDNavigationSchool::linkEndcapLayers(const MapE& layers, vector& result) { - for (MapEI el = layers.begin(); el != layers.end(); el++) { - MTDEtaRange range = (*el).second; - // first add next endcap layer (if compatible) - MapEI plusOne(el); - plusOne++; - MapE outerLayers; - if (plusOne != layers.end() && (*plusOne).second.isCompatible(range)) { - outerLayers.insert(*plusOne); - if (!range.isInside((*plusOne).second)) { - // then look if the next layer has a wider eta range, if so add it - MapEI tmpel(plusOne); - tmpel++; - MTDEtaRange max((*plusOne).second); - for (MapEI l = tmpel; l != layers.end(); l++) { - MTDEtaRange next = (*l).second; - if (next.isCompatible(max) && !range.isInside(next) && !next.isInside(max) && - next.subtract(max).isInside(range)) { - max = max.add(next); - outerLayers.insert(*l); - } - } - } - } - - MapE allOuterLayers; - for (MapEI iMEI = plusOne; iMEI != layers.end(); iMEI++) { - if ((*iMEI).second.isCompatible(range)) - allOuterLayers.insert(*iMEI); - } - - result.push_back(new ETLNavigableLayer((*el).first, outerLayers, allOuterLayers)); - } -} - -/// create inverse links (i.e. inwards) -void MTDNavigationSchool::createInverseLinks() { - // set outward link - // NavigationSetter setter(*this); - - setState(navigableLayers()); - - // find for each layer which are the layers pointing to it - typedef map > BarrelMapType; - typedef map > ForwardMapType; - - // map of all DetLayers which can reach a specific DetLayer - BarrelMapType reachedBarrelLayersMap; - ForwardMapType reachedForwardLayersMap; - - // map of all DetLayers which is compatible with a specific DetLayer - BarrelMapType compatibleBarrelLayersMap; - ForwardMapType compatibleForwardLayersMap; - - // collect all reacheable layers starting from a barrel layer - for (MapBI bli = theBarrelLayers.begin(); bli != theBarrelLayers.end(); bli++) { - // barrel - BTLNavigableLayer* mbnl = dynamic_cast(theAllNavigableLayer[((*bli).first)->seqNum()]); - MapB reacheableB = mbnl->getOuterBarrelLayers(); - for (MapBI i = reacheableB.begin(); i != reacheableB.end(); i++) { - reachedBarrelLayersMap[(*i).first].insert(*bli); - } - MapB compatibleB = mbnl->getAllOuterBarrelLayers(); - for (MapBI i = compatibleB.begin(); i != compatibleB.end(); i++) { - compatibleBarrelLayersMap[(*i).first].insert(*bli); - } - MapE reacheableE = mbnl->getOuterBackwardLayers(); - for (MapEI i = reacheableE.begin(); i != reacheableE.end(); i++) { - reachedBarrelLayersMap[(*i).first].insert(*bli); - } - reacheableE = mbnl->getOuterForwardLayers(); - for (MapEI i = reacheableE.begin(); i != reacheableE.end(); i++) { - reachedBarrelLayersMap[(*i).first].insert(*bli); - } - MapE compatibleE = mbnl->getAllOuterBackwardLayers(); - for (MapEI i = compatibleE.begin(); i != compatibleE.end(); i++) { - compatibleBarrelLayersMap[(*i).first].insert(*bli); - } - compatibleE = mbnl->getAllOuterForwardLayers(); - for (MapEI i = compatibleE.begin(); i != compatibleE.end(); i++) { - compatibleBarrelLayersMap[(*i).first].insert(*bli); - } - } - - // collect all reacheable layer starting from a backward layer - for (MapEI eli = theBackwardLayers.begin(); eli != theBackwardLayers.end(); eli++) { - MapE reacheableE = - dynamic_cast(theAllNavigableLayer[((*eli).first)->seqNum()])->getOuterEndcapLayers(); - for (MapEI i = reacheableE.begin(); i != reacheableE.end(); i++) { - reachedForwardLayersMap[(*i).first].insert(*eli); - } - // collect all compatible layer starting from a backward layer - MapE compatibleE = - dynamic_cast(theAllNavigableLayer[((*eli).first)->seqNum()])->getAllOuterEndcapLayers(); - for (MapEI i = compatibleE.begin(); i != compatibleE.end(); i++) { - compatibleForwardLayersMap[(*i).first].insert(*eli); - } - } - - for (MapEI eli = theForwardLayers.begin(); eli != theForwardLayers.end(); eli++) { - // collect all reacheable layer starting from a forward layer - MapE reacheableE = - dynamic_cast(theAllNavigableLayer[((*eli).first)->seqNum()])->getOuterEndcapLayers(); - for (MapEI i = reacheableE.begin(); i != reacheableE.end(); i++) { - reachedForwardLayersMap[(*i).first].insert(*eli); - } - // collect all compatible layer starting from a forward layer - MapE compatibleE = - dynamic_cast(theAllNavigableLayer[((*eli).first)->seqNum()])->getAllOuterEndcapLayers(); - for (MapEI i = compatibleE.begin(); i != compatibleE.end(); i++) { - compatibleForwardLayersMap[(*i).first].insert(*eli); - } - } - - // now set inverse link for barrel layers - for (MapBI bli = theBarrelLayers.begin(); bli != theBarrelLayers.end(); bli++) { - BTLNavigableLayer* mbnl = dynamic_cast(theAllNavigableLayer[((*bli).first)->seqNum()]); - mbnl->setInwardLinks(reachedBarrelLayersMap[(*bli).first]); - mbnl->setInwardCompatibleLinks(compatibleBarrelLayersMap[(*bli).first]); - } - //BACKWARD - for (MapEI eli = theBackwardLayers.begin(); eli != theBackwardLayers.end(); eli++) { - ETLNavigableLayer* mfnl = dynamic_cast(theAllNavigableLayer[((*eli).first)->seqNum()]); - // for backward next layers - mfnl->setInwardLinks(reachedBarrelLayersMap[(*eli).first], reachedForwardLayersMap[(*eli).first]); - // for backward compatible layers - mfnl->setInwardCompatibleLinks(compatibleBarrelLayersMap[(*eli).first], compatibleForwardLayersMap[(*eli).first]); - } - //FORWARD - for (MapEI eli = theForwardLayers.begin(); eli != theForwardLayers.end(); eli++) { - ETLNavigableLayer* mfnl = dynamic_cast(theAllNavigableLayer[((*eli).first)->seqNum()]); - // and for forward next layers - mfnl->setInwardLinks(reachedBarrelLayersMap[(*eli).first], reachedForwardLayersMap[(*eli).first]); - // and for forward compatible layers - mfnl->setInwardCompatibleLinks(compatibleBarrelLayersMap[(*eli).first], compatibleForwardLayersMap[(*eli).first]); - } -} diff --git a/RecoMTD/Navigation/test/BuildFile.xml b/RecoMTD/Navigation/test/BuildFile.xml deleted file mode 100644 index dcc36ac6c5399..0000000000000 --- a/RecoMTD/Navigation/test/BuildFile.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/RecoMTD/Navigation/test/MTDNavigationTest.cc b/RecoMTD/Navigation/test/MTDNavigationTest.cc deleted file mode 100644 index 6b38bd987c4bf..0000000000000 --- a/RecoMTD/Navigation/test/MTDNavigationTest.cc +++ /dev/null @@ -1,79 +0,0 @@ -#include -/** \file MTDNavigationTest - * - * \author L. Gray - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "RecoMTD/Navigation/interface/MTDNavigationPrinter.h" -#include "RecoMTD/Navigation/interface/MTDNavigationSchool.h" -#include "RecoMTD/Records/interface/MTDRecoGeometryRecord.h" -#include "RecoMTD/Navigation/interface/MTDNavigationPrinter.h" -#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -class MTDNavigationTest : public edm::EDAnalyzer { -public: - explicit MTDNavigationTest(const edm::ParameterSet&); - ~MTDNavigationTest(); - - virtual void analyze(const edm::Event&, const edm::EventSetup&); - -private: -}; - -// constructor - -MTDNavigationTest::MTDNavigationTest(const edm::ParameterSet& iConfig) { - std::cout << "Muon Navigation Printer Begin:" << std::endl; -} - -MTDNavigationTest::~MTDNavigationTest() { std::cout << "Muon Navigation Printer End. " << std::endl; } - -void MTDNavigationTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - using namespace edm; - - //choose ONE and ONLY one to be true - bool testMuon = true; - // bool testMuonTk = true; - // - // get Geometry - // - edm::ESHandle mtd; - iSetup.get().get(mtd); - const MTDDetLayerGeometry* mm(&(*mtd)); - - if (testMuon) { - MTDNavigationSchool school(mm); - MTDNavigationPrinter* printer = new MTDNavigationPrinter(mm, school); - delete printer; - } - /* - if ( testMuonTk ) { - edm::ESHandle tracker; - iSetup.get().get(tracker); - - edm::ESHandle theMF; - iSetup.get().get(theMF); - - const GeometricSearchTracker * tt(&(*tracker)); - const MagneticField * field(&(*theMF)); - - MuonTkNavigationSchool school(mm,tt,field); - MTDNavigationPrinter* printer = new MTDNavigationPrinter(mm, tt); - delete printer; - } -*/ -} - -//define this as a plug-in -DEFINE_FWK_MODULE(MTDNavigationTest); diff --git a/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc b/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc index c311758fc9d78..afaa27d3695f2 100644 --- a/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc +++ b/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc @@ -395,8 +395,16 @@ class TrackExtenderWithMTDT : public edm::stream::EDProducer<> { std::unique_ptr theEstimator; std::unique_ptr theTransformer; edm::ESHandle builder_; + edm::ESGetToken builderToken_; edm::ESHandle hitbuilder_; + edm::ESGetToken hitbuilderToken_; edm::ESHandle gtg_; + edm::ESGetToken gtgToken_; + + edm::ESGetToken dlgeoToken_; + edm::ESGetToken magfldToken_; + edm::ESGetToken propToken_; + edm::ESGetToken ttopoToken_; const float estMaxChi2_; const float estMaxNSigma_; @@ -459,6 +467,15 @@ TrackExtenderWithMTDT::TrackExtenderWithMTDT(const ParameterSet sigmatmtdOrigTrkToken = produces>("generalTracksigmatmtd"); assocOrigTrkToken = produces>("generalTrackassoc"); + builderToken_ = esConsumes(edm::ESInputTag("", transientTrackBuilder_)); + hitbuilderToken_ = + esConsumes(edm::ESInputTag("", mtdRecHitBuilder_)); + gtgToken_ = esConsumes(); + dlgeoToken_ = esConsumes(); + magfldToken_ = esConsumes(); + propToken_ = esConsumes(edm::ESInputTag("", propagator_)); + ttopoToken_ = esConsumes(); + produces>(); produces(); produces(); @@ -526,23 +543,19 @@ void TrackExtenderWithMTDT::produce(edm::Event& ev, const edm:: TrackingRecHitRefProd hitsRefProd = ev.getRefBeforePut(); reco::TrackExtraRefProd extrasRefProd = ev.getRefBeforePut(); - es.get().get(gtg_); + gtg_ = es.getHandle(gtgToken_); - edm::ESHandle geo; - es.get().get(geo); + auto geo = es.getTransientHandle(dlgeoToken_); - edm::ESHandle magfield; - es.get().get(magfield); + auto magfield = es.getTransientHandle(magfldToken_); - es.get().get(transientTrackBuilder_, builder_); - es.get().get(mtdRecHitBuilder_, hitbuilder_); + builder_ = es.getHandle(builderToken_); + hitbuilder_ = es.getHandle(hitbuilderToken_); - edm::ESHandle propH; - es.get().get(propagator_, propH); + auto propH = es.getTransientHandle(propToken_); const Propagator* prop = propH.product(); - edm::ESHandle httopo; - es.get().get(httopo); + auto httopo = es.getTransientHandle(ttopoToken_); const TrackerTopology& ttopo = *httopo; auto output = std::make_unique(); diff --git a/RecoPPS/Configuration/python/recoCTPPS_cff.py b/RecoPPS/Configuration/python/recoCTPPS_cff.py index dde4ac1fa06d8..2bfe9320d2f11 100644 --- a/RecoPPS/Configuration/python/recoCTPPS_cff.py +++ b/RecoPPS/Configuration/python/recoCTPPS_cff.py @@ -21,9 +21,4 @@ ctppsProtons ) -#temporarily remove ctppsProtons in Run-3 (see issue #32340) -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -_ctpps_2021_recoCTPPSTask = recoCTPPSTask.copyAndExclude([ctppsProtons]) -ctpps_2021.toReplaceWith(recoCTPPSTask, _ctpps_2021_recoCTPPSTask) - recoCTPPS = cms.Sequence(recoCTPPSTask) diff --git a/RecoPPS/Configuration/test/raw_data_test.py b/RecoPPS/Configuration/test/raw_data_test.py index faf0e6ef123fc..2280073282f86 100644 --- a/RecoPPS/Configuration/test/raw_data_test.py +++ b/RecoPPS/Configuration/test/raw_data_test.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -process = cms.Process("CTPPSReconstructionChainTest", ctpps_2016) +from Configuration.Eras.Modifier_ctpps_cff import ctpps +process = cms.Process("CTPPSReconstructionChainTest", ctpps) # minimum of logs process.MessageLogger = cms.Service("MessageLogger", diff --git a/RecoPPS/Local/plugins/CTPPSLocalTrackLiteProducer.cc b/RecoPPS/Local/plugins/CTPPSLocalTrackLiteProducer.cc index 3ecd94df9c9f3..baeb45166b105 100644 --- a/RecoPPS/Local/plugins/CTPPSLocalTrackLiteProducer.cc +++ b/RecoPPS/Local/plugins/CTPPSLocalTrackLiteProducer.cc @@ -238,7 +238,7 @@ void CTPPSLocalTrackLiteProducer::fillDescriptions(edm::ConfigurationDescription edm::ParameterSetDescription desc; // By default: all includeXYZ flags set to false. - // The includeXYZ are switched on when the "ctpps_2016" era is declared in + // The includeXYZ are switched on when the "ctpps" era modifier is declared in // python config, see: // RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py diff --git a/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py b/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py index f40ccec3b789c..379be28dca719 100644 --- a/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py +++ b/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py @@ -5,8 +5,8 @@ ctppsLocalTrackLiteProducer = ctppsLocalTrackLiteDefaultProducer.clone() # enable the module for CTPPS era(s) -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -ctpps_2016.toModify( +from Configuration.Eras.Modifier_ctpps_cff import ctpps +ctpps.toModify( ctppsLocalTrackLiteProducer, includeStrips = True, includeDiamonds = True, diff --git a/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py b/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py index 03b01f2299540..54aea2a4f758c 100644 --- a/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py +++ b/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py @@ -10,7 +10,7 @@ from RecoPPS.ProtonReconstruction.ctppsProtons_cfi import * ctppsProtons.lhcInfoLabel = ctppsLHCInfoLabel -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_cff import ctpps from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 @@ -34,7 +34,7 @@ def applyDefaultSettings(ctppsProtons): ctppsProtons.pixelDiscardBXShiftedTracks = True ctppsProtons.default_time = -999. -ctpps_2016.toModify(ctppsProtons, applyDefaultSettings) # applied for all Run2 years (2016, 2017 and 2018) +ctpps.toModify(ctppsProtons, applyDefaultSettings) def apply2017Settings(ctppsProtons): ctppsProtons.association_cuts_45.x_cut_apply = False diff --git a/RecoParticleFlow/PFClusterProducer/interface/PFClusterEMEnergyCorrector.h b/RecoParticleFlow/PFClusterProducer/interface/PFClusterEMEnergyCorrector.h index 0ba2e3a7a7c06..2b10d4a990b58 100644 --- a/RecoParticleFlow/PFClusterProducer/interface/PFClusterEMEnergyCorrector.h +++ b/RecoParticleFlow/PFClusterProducer/interface/PFClusterEMEnergyCorrector.h @@ -46,6 +46,7 @@ class PFClusterEMEnergyCorrector { edm::EDGetTokenT bunchSpacing_; const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; + const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_; std::vector condnames_mean_; std::vector condnames_sigma_; diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFBadHcalPseudoClusterProducer.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFBadHcalPseudoClusterProducer.cc index a19c13a92dcaa..b2c4b59d849d2 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFBadHcalPseudoClusterProducer.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFBadHcalPseudoClusterProducer.cc @@ -164,7 +164,7 @@ void PFBadHcalPseudoClusterProducer::produce(edm::Event& iEvent, const edm::Even void PFBadHcalPseudoClusterProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("enable", false) + desc.add("enable", true) ->setComment("activate the module (if false, it doesn't check the DB and produces an empty collection)"); desc.addUntracked("debug", false); descriptions.add("particleFlowBadHcalPseudoCluster", desc); diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowBadHcalPseudoCluster_cff.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowBadHcalPseudoCluster_cff.py index 028b5381922ea..7993a869c5bda 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowBadHcalPseudoCluster_cff.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowBadHcalPseudoCluster_cff.py @@ -1,6 +1,7 @@ from RecoParticleFlow.PFClusterProducer.particleFlowBadHcalPseudoCluster_cfi import * -# OFF by default, turned on via modifier -from Configuration.Eras.Modifier_pf_badHcalMitigation_cff import pf_badHcalMitigation -pf_badHcalMitigation.toModify(particleFlowBadHcalPseudoCluster, enable = True) +# ON by default, turned off via modifier +from Configuration.Eras.Modifier_pf_badHcalMitigationOff_cff import pf_badHcalMitigationOff +pf_badHcalMitigationOff.toModify(particleFlowBadHcalPseudoCluster, enable = False) + diff --git a/RecoParticleFlow/PFClusterProducer/src/PFClusterEMEnergyCorrector.cc b/RecoParticleFlow/PFClusterProducer/src/PFClusterEMEnergyCorrector.cc index 5d63ea8f43ea1..9ea29164b6fe4 100644 --- a/RecoParticleFlow/PFClusterProducer/src/PFClusterEMEnergyCorrector.cc +++ b/RecoParticleFlow/PFClusterProducer/src/PFClusterEMEnergyCorrector.cc @@ -12,7 +12,9 @@ namespace { } // namespace PFClusterEMEnergyCorrector::PFClusterEMEnergyCorrector(const edm::ParameterSet &conf, edm::ConsumesCollector &&cc) - : ecalClusterToolsESGetTokens_{std::move(cc)}, calibrator_(new PFEnergyCalibration) { + : ecalClusterToolsESGetTokens_{std::move(cc)}, + ecalReadoutToolsESGetTokens_{conf, std::move(cc)}, + calibrator_(new PFEnergyCalibration) { applyCrackCorrections_ = conf.getParameter("applyCrackCorrections"); applyMVACorrections_ = conf.getParameter("applyMVACorrections"); srfAwareCorrection_ = conf.getParameter("srfAwareCorrection"); @@ -149,7 +151,7 @@ void PFClusterEMEnergyCorrector::correctEnergies(const edm::Event &evt, // Common objects for SRF-aware and old style corrections EcalClusterLazyTools lazyTool(evt, ecalClusterToolsESGetTokens_.get(es), recHitsEB_, recHitsEE_); - EcalReadoutTools readoutTool(evt, es); + EcalReadoutTools readoutTool(evt, es, ecalReadoutToolsESGetTokens_); if (!srfAwareCorrection_) { int bunchspacing = 450; diff --git a/RecoParticleFlow/PFProducer/python/particleFlow_cff.py b/RecoParticleFlow/PFProducer/python/particleFlow_cff.py index db8d3cfff0dc8..cbe424ea2a15e 100644 --- a/RecoParticleFlow/PFProducer/python/particleFlow_cff.py +++ b/RecoParticleFlow/PFProducer/python/particleFlow_cff.py @@ -10,10 +10,10 @@ particleFlowTmp = particleFlow.clone() -from Configuration.Eras.Modifier_pf_badHcalMitigation_cff import pf_badHcalMitigation -pf_badHcalMitigation.toModify(particleFlowTmp.PFEGammaFiltersParameters, - electron_protectionsForBadHcal = dict(enableProtections = True), - photon_protectionsForBadHcal = dict(enableProtections = True)) +from Configuration.Eras.Modifier_pf_badHcalMitigationOff_cff import pf_badHcalMitigationOff +pf_badHcalMitigationOff.toModify(particleFlowTmp.PFEGammaFiltersParameters, + electron_protectionsForBadHcal = dict(enableProtections = False), + photon_protectionsForBadHcal = dict(enableProtections = False)) from Configuration.ProcessModifiers.egamma_lowPt_exclusive_cff import egamma_lowPt_exclusive egamma_lowPt_exclusive.toModify(particleFlowTmp.PFEGammaFiltersParameters,photon_MinEt = 1.) diff --git a/RecoParticleFlow/PFProducer/src/PFEGammaFilters.cc b/RecoParticleFlow/PFProducer/src/PFEGammaFilters.cc index a39c7c5943119..3c8f2f9f078bd 100644 --- a/RecoParticleFlow/PFProducer/src/PFEGammaFilters.cc +++ b/RecoParticleFlow/PFProducer/src/PFEGammaFilters.cc @@ -430,7 +430,7 @@ void PFEGammaFilters::fillPSetDescription(edm::ParameterSetDescription& iDesc) { } { edm::ParameterSetDescription psd; - psd.add("enableProtections", false); + psd.add("enableProtections", true); psd.add>("full5x5_sigmaIetaIeta", // EB, EE; 94Xv2 cut-based medium id {0.0106, 0.0387}); psd.add>("eInvPInv", {0.184, 0.0721}); @@ -455,7 +455,7 @@ void PFEGammaFilters::fillPSetDescription(edm::ParameterSetDescription& iDesc) { { edm::ParameterSetDescription psd; psd.add("solidConeTrkIsoSlope", 0.3); - psd.add("enableProtections", false); + psd.add("enableProtections", true); psd.add("solidConeTrkIsoOffset", 10.0); iDesc.add("photon_protectionsForBadHcal", psd); } diff --git a/RecoParticleFlow/PFTracking/interface/LightPFTrackProducer.h b/RecoParticleFlow/PFTracking/interface/LightPFTrackProducer.h index 8bce50f34c9ed..f40b22e26dfc6 100644 --- a/RecoParticleFlow/PFTracking/interface/LightPFTrackProducer.h +++ b/RecoParticleFlow/PFTracking/interface/LightPFTrackProducer.h @@ -8,6 +8,8 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" class PFTrackTransformer; class LightPFTrackProducer : public edm::stream::EDProducer<> { @@ -28,6 +30,8 @@ class LightPFTrackProducer : public edm::stream::EDProducer<> { ///PFTrackTransformer PFTrackTransformer *pfTransformer_; std::vector > tracksContainers_; + + const edm::ESGetToken magneticFieldToken_; ///TRACK QUALITY bool useQuality_; reco::TrackBase::TrackQuality trackQuality_; diff --git a/RecoParticleFlow/PFTracking/interface/PFNuclearProducer.h b/RecoParticleFlow/PFTracking/interface/PFNuclearProducer.h index 6f9fa15ba2e3c..e70474299f6ca 100644 --- a/RecoParticleFlow/PFTracking/interface/PFNuclearProducer.h +++ b/RecoParticleFlow/PFTracking/interface/PFNuclearProducer.h @@ -7,6 +7,8 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "DataFormats/ParticleFlowReco/interface/PFNuclearInteraction.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" class PFTrackTransformer; class PFNuclearProducer : public edm::stream::EDProducer<> { @@ -28,5 +30,7 @@ class PFNuclearProducer : public edm::stream::EDProducer<> { PFTrackTransformer *pfTransformer_; double likelihoodCut_; std::vector > nuclearContainers_; + + const edm::ESGetToken magneticFieldToken_; }; #endif diff --git a/RecoParticleFlow/PFTracking/interface/PFTrackProducer.h b/RecoParticleFlow/PFTracking/interface/PFTrackProducer.h index b94498801a954..bf721540530ab 100644 --- a/RecoParticleFlow/PFTracking/interface/PFTrackProducer.h +++ b/RecoParticleFlow/PFTracking/interface/PFTrackProducer.h @@ -11,6 +11,10 @@ #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "RecoParticleFlow/PFTracking/interface/PFTrackTransformer.h" #include @@ -37,6 +41,9 @@ class PFTrackProducer : public edm::stream::EDProducer<> { ///Produce the PFRecTrack collection void produce(edm::Event&, const edm::EventSetup&) override; + const edm::ESGetToken transientTrackToken_; + const edm::ESGetToken magneticFieldToken_; + ///PFTrackTransformer std::unique_ptr pfTransformer_; std::vector> tracksContainers_; diff --git a/RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc b/RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc index 564d415494ec3..7c239cfa61d61 100644 --- a/RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc @@ -158,6 +158,12 @@ class GoodSeedProducer final : public edm::stream::EDProducer resMapEtaECAL_; std::unique_ptr resMapPhiECAL_; + const edm::ESGetToken fitterToken_; + const edm::ESGetToken smootherToken_; + const edm::ESGetToken trackerRecHitBuilderToken_; + const edm::ESGetToken magneticFieldToken_; + const edm::ESGetToken magneticFieldTokenBeginRun_; + ///TRACK QUALITY bool useQuality_; reco::TrackBase::TrackQuality trackQuality_; @@ -182,7 +188,15 @@ using namespace std; using namespace reco; GoodSeedProducer::GoodSeedProducer(const ParameterSet& iConfig, const goodseedhelpers::HeavyObjectCache*) - : pfTransformer_(nullptr), conf_(iConfig), resMapEtaECAL_(nullptr), resMapPhiECAL_(nullptr) { + : pfTransformer_(nullptr), + conf_(iConfig), + resMapEtaECAL_(nullptr), + resMapPhiECAL_(nullptr), + fitterToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("Fitter")))), + smootherToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("Smoother")))), + trackerRecHitBuilderToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("TTRHBuilder")))), + magneticFieldToken_(esConsumes()), + magneticFieldTokenBeginRun_(esConsumes()) { LogInfo("GoodSeedProducer") << "Electron PreIdentification started "; //now do what ever initialization is needed @@ -283,15 +297,13 @@ void GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup) { //Tracking Tools if (!disablePreId_) { - edm::ESHandle aFitter; - edm::ESHandle aSmoother; - iSetup.get().get(fitterName_, aFitter); - iSetup.get().get(smootherName_, aSmoother); + auto const& aFitter = &iSetup.getData(fitterToken_); + auto const& aSmoother = &iSetup.getData(smootherToken_); + smoother.reset(aSmoother->clone()); fitter = aFitter->clone(); - edm::ESHandle theTrackerRecHitBuilder; - iSetup.get().get(trackerRecHitBuilderName_, theTrackerRecHitBuilder); - hitCloner = static_cast(theTrackerRecHitBuilder.product())->cloner(); + auto const& theTrackerRecHitBuilder = &iSetup.getData(trackerRecHitBuilderToken_); + hitCloner = static_cast(theTrackerRecHitBuilder)->cloner(); fitter->setHitCloner(&hitCloner); smoother->setHitCloner(&hitCloner); } @@ -300,8 +312,7 @@ void GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup) { refMap_.clear(); //Magnetic Field - ESHandle magneticField; - iSetup.get().get(magneticField); + auto const& magneticField = &iSetup.getData(magneticFieldToken_); //Handle input collections //ECAL clusters @@ -607,8 +618,7 @@ namespace goodseedhelpers { // ------------ method called once each job just before starting event loop ------------ void GoodSeedProducer::beginRun(const edm::Run& run, const EventSetup& es) { //Magnetic Field - ESHandle magneticField; - es.get().get(magneticField); + auto const& magneticField = &es.getData(magneticFieldTokenBeginRun_); B_ = magneticField->inTesla(GlobalPoint(0, 0, 0)); pfTransformer_ = std::make_unique(B_); diff --git a/RecoParticleFlow/PFTracking/plugins/HGCalTrackCollectionProducer.cc b/RecoParticleFlow/PFTracking/plugins/HGCalTrackCollectionProducer.cc index 043a0b2b4e4cb..99a80659987a3 100644 --- a/RecoParticleFlow/PFTracking/plugins/HGCalTrackCollectionProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/HGCalTrackCollectionProducer.cc @@ -4,18 +4,16 @@ // Tracks with bad pt resolution (suspected fakes) are dropped and not in either collection #include "FWCore/Framework/interface/MakerMacros.h" - +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "RecoParticleFlow/PFClusterProducer/interface/InitialClusteringStepBase.h" #include "DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "RecoParticleFlow/PFClusterProducer/interface/PFCPositionCalculatorBase.h" #include "RecoParticleFlow/PFTracking/interface/PFTrackAlgoTools.h" - #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" - -//#include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h" #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h" #include "DataFormats/TrackReco/interface/Track.h" @@ -35,11 +33,7 @@ #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" - #include - #include class HGCalTrackCollectionProducer : public edm::stream::EDProducer<> { @@ -62,10 +56,14 @@ class HGCalTrackCollectionProducer : public edm::stream::EDProducer<> { // const bool _useFirstLayerOnly; // always true now // variables needed for copied extrapolation - edm::ESHandle bField_; - edm::ESHandle tkGeom_; - std::array hgc_names_; // 3 --> 1; extrapolate to hgcee only - std::array, 1> hgcGeometries_; // 3 --> 1; extrapolate to hgcee only + const edm::ESGetToken magneticFieldToken_; + const edm::ESGetToken tkerGeomToken_; + const MagneticField* bField_; + const TrackerGeometry* tkGeom_; + std::array hgc_names_; // 3 --> 1; extrapolate to hgcee only + std::array, 1> + hgcGeometryTokens_; // 3 --> 1; extrapolate to hgcee only + std::array hgcGeometries_; // 3 --> 1; extrapolate to hgcee only std::array >, 1> plusSurface_, minusSurface_; // 3 --> 1; extrapolate to hgcee only std::unique_ptr mat_prop_; @@ -81,12 +79,17 @@ HGCalTrackCollectionProducer::HGCalTrackCollectionProducer(const edm::ParameterS : reco::TrackBase::highPurity), DPtovPtCut_(iConfig.getParameter >("DPtOverPtCuts_byTrackAlgo")), NHitCut_(iConfig.getParameter >("NHitCuts_byTrackAlgo")), - useIterTracking_(iConfig.getParameter("useIterativeTracking")) { + useIterTracking_(iConfig.getParameter("useIterativeTracking")), + magneticFieldToken_(esConsumes()), + tkerGeomToken_(esConsumes()) { LogDebug("HGCalTrackCollectionProducer") << " HGCalTrackCollectionProducer::HGCalTrackCollectionProducer " << std::endl; const edm::ParameterSet& geoconf = iConfig.getParameterSet("hgcalGeometryNames"); hgc_names_[0] = geoconf.getParameter("HGC_ECAL"); + for (unsigned i = 0; i < hgcGeometryTokens_.size(); i++) { + hgcGeometryTokens_[i] = esConsumes(edm::ESInputTag("", hgc_names_[i])); + } produces("TracksInHGCal"); produces("TracksNotInHGCal"); @@ -97,15 +100,15 @@ HGCalTrackCollectionProducer::HGCalTrackCollectionProducer(const edm::ParameterS void HGCalTrackCollectionProducer::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& es) { constexpr float m_pion = 0.1396; // get dependencies for setting up propagator - es.get().get(bField_); - es.get().get(tkGeom_); + bField_ = &es.getData(magneticFieldToken_); + tkGeom_ = &es.getData(tkerGeomToken_); // get HGC geometries (assume that layers are ordered in Z!) for (unsigned i = 0; i < hgcGeometries_.size(); ++i) { - es.get().get(hgc_names_[i], hgcGeometries_[i]); + hgcGeometries_[i] = &es.getData(hgcGeometryTokens_[i]); } // make propagator - mat_prop_ = std::make_unique(alongMomentum, m_pion, bField_.product()); + mat_prop_ = std::make_unique(alongMomentum, m_pion, bField_); // setup HGC layers for track propagation Surface::RotationType rot; //unit rotation matrix for (unsigned i = 0; i < hgcGeometries_.size(); ++i) { @@ -147,7 +150,7 @@ void HGCalTrackCollectionProducer::produce(edm::Event& evt, const edm::EventSetu continue; bool found = false; const TrajectoryStateOnSurface myTSOS = - trajectoryStateTransform::outerStateOnSurface(*(track->trackRef()), *(tkGeom_.product()), bField_.product()); + trajectoryStateTransform::outerStateOnSurface(*(track->trackRef()), *tkGeom_, bField_); auto detbegin = myTSOS.globalPosition().z() > 0 ? plusSurface_.begin() : minusSurface_.begin(); auto detend = myTSOS.globalPosition().z() > 0 ? plusSurface_.end() : minusSurface_.end(); for (auto det = detbegin; det != detend; ++det) { diff --git a/RecoParticleFlow/PFTracking/plugins/LightPFTrackProducer.cc b/RecoParticleFlow/PFTracking/plugins/LightPFTrackProducer.cc index 56ce7cfe306a2..006ce38096429 100644 --- a/RecoParticleFlow/PFTracking/plugins/LightPFTrackProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/LightPFTrackProducer.cc @@ -6,12 +6,11 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" using namespace std; using namespace edm; -LightPFTrackProducer::LightPFTrackProducer(const ParameterSet& iConfig) : pfTransformer_(nullptr) { +LightPFTrackProducer::LightPFTrackProducer(const ParameterSet& iConfig) + : pfTransformer_(nullptr), magneticFieldToken_(esConsumes()) { produces(); std::vector tags = iConfig.getParameter >("TkColList"); @@ -51,8 +50,7 @@ void LightPFTrackProducer::produce(Event& iEvent, const EventSetup& iSetup) { // ------------ method called once each job just before starting event loop ------------ void LightPFTrackProducer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); + auto const& magneticField = &iSetup.getData(magneticFieldToken_); pfTransformer_ = new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); pfTransformer_->OnlyProp(); } diff --git a/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.cc index 81346e7bf47ae..7fa2389eef746 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.cc @@ -4,19 +4,18 @@ #include "DataFormats/VertexReco/interface/Vertex.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "DataFormats/Common/interface/RefToBase.h" #include "CommonTools/Statistics/interface/ChiSquaredProbability.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/IPTools/interface/IPTools.h" typedef std::multimap > BlockMap; using namespace std; using namespace edm; -PFConversionProducer::PFConversionProducer(const ParameterSet& iConfig) : pfTransformer_(nullptr) { +PFConversionProducer::PFConversionProducer(const ParameterSet& iConfig) + : pfTransformer_(nullptr), + transientTrackToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + magneticFieldToken_(esConsumes()) { produces(); produces(); @@ -32,9 +31,8 @@ void PFConversionProducer::produce(Event& iEvent, const EventSetup& iSetup) { auto pfConversionColl = std::make_unique(); auto pfRecTrackColl = std::make_unique(); - edm::ESHandle builder; - iSetup.get().get("TransientTrackBuilder", builder); - TransientTrackBuilder thebuilder = *(builder.product()); + TransientTrackBuilder const& thebuilder = iSetup.getData(transientTrackToken_); + reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut(); Handle convCollH; iEvent.getByToken(pfConversionContainer_, convCollH); @@ -164,8 +162,7 @@ void PFConversionProducer::produce(Event& iEvent, const EventSetup& iSetup) { // ------------ method called once each job just before starting event loop ------------ void PFConversionProducer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); + auto const& magneticField = &iSetup.getData(magneticFieldToken_); pfTransformer_ = new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); pfTransformer_->OnlyProp(); } diff --git a/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.h b/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.h index 8524218b90f1e..b65937d90d28e 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.h +++ b/RecoParticleFlow/PFTracking/plugins/PFConversionProducer.h @@ -9,6 +9,10 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/ParticleFlowReco/interface/PFConversion.h" #include "DataFormats/ParticleFlowReco/interface/PFConversionFwd.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" class PFTrackTransformer; class PFConversionProducer : public edm::stream::EDProducer<> { @@ -30,5 +34,8 @@ class PFConversionProducer : public edm::stream::EDProducer<> { PFTrackTransformer *pfTransformer_; edm::EDGetTokenT pfConversionContainer_; edm::EDGetTokenT vtx_h; + + const edm::ESGetToken transientTrackToken_; + const edm::ESGetToken magneticFieldToken_; }; #endif diff --git a/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.cc index 348133ea71e0e..6c38562092f88 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.cc @@ -3,12 +3,11 @@ #include "RecoParticleFlow/PFTracking/interface/PFTrackTransformer.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + using namespace std; using namespace edm; PFDisplacedTrackerVertexProducer::PFDisplacedTrackerVertexProducer(const ParameterSet& iConfig) - : pfTransformer_(nullptr) { + : pfTransformer_(nullptr), magneticFieldToken_(esConsumes()) { produces(); produces(); @@ -77,8 +76,7 @@ void PFDisplacedTrackerVertexProducer::produce(Event& iEvent, const EventSetup& // ------------ method called once each job just before starting event loop ------------ void PFDisplacedTrackerVertexProducer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); + auto const& magneticField = &iSetup.getData(magneticFieldToken_); pfTransformer_ = new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); pfTransformer_->OnlyProp(); } diff --git a/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.h b/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.h index 3ecd90ec161d7..c76dfe214b55a 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.h +++ b/RecoParticleFlow/PFTracking/plugins/PFDisplacedTrackerVertexProducer.h @@ -7,6 +7,8 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "DataFormats/ParticleFlowReco/interface/PFDisplacedTrackerVertex.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" class PFTrackTransformer; class PFDisplacedTrackerVertexProducer : public edm::stream::EDProducer<> { @@ -28,5 +30,7 @@ class PFDisplacedTrackerVertexProducer : public edm::stream::EDProducer<> { PFTrackTransformer *pfTransformer_; edm::EDGetTokenT pfDisplacedVertexContainer_; edm::EDGetTokenT pfTrackContainer_; + + const edm::ESGetToken magneticFieldToken_; }; #endif diff --git a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.cc index 4a002b27d52ad..da59f0142dbb4 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.cc @@ -1,22 +1,17 @@ #include "RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.h" - #include "FWCore/Framework/interface/ESHandle.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "FWCore/ParameterSet/interface/FileInPath.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - #include using namespace std; using namespace edm; -PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer(const edm::ParameterSet& iConfig) { +PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer(const edm::ParameterSet& iConfig) + : magneticFieldToken_(esConsumes()) { // --- Setup input collection names --- // inputTagTracks_ = consumes(iConfig.getParameter("trackCollection")); @@ -58,9 +53,7 @@ void PFDisplacedVertexCandidateProducer::produce(Event& iEvent, const EventSetup << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl; // Prepare and fill useful event information for the Finder - edm::ESHandle magField; - iSetup.get().get(magField); - const MagneticField* theMagField = magField.product(); + auto const& theMagField = &iSetup.getData(magneticFieldToken_); Handle trackCollection; iEvent.getByToken(inputTagTracks_, trackCollection); diff --git a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.h b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.h index ec632c8eff388..85ae032ddd46c 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.h +++ b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.h @@ -5,13 +5,13 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "RecoParticleFlow/PFTracking/interface/PFDisplacedVertexCandidateFinder.h" #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidateFwd.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" /**\class PFDisplacedVertexCandidateProducer \brief Producer for DisplacedVertices @@ -40,6 +40,8 @@ class PFDisplacedVertexCandidateProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT inputTagMainVertex_; edm::EDGetTokenT inputTagBeamSpot_; + const edm::ESGetToken magneticFieldToken_; + /// verbose ? bool verbose_; diff --git a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.cc index 8c046799c1902..99ce7e376a52d 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.cc @@ -1,21 +1,9 @@ #include "RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.h" - #include "FWCore/Framework/interface/ESHandle.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" - #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h" #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidateFwd.h" @@ -24,7 +12,11 @@ using namespace std; using namespace edm; -PFDisplacedVertexProducer::PFDisplacedVertexProducer(const edm::ParameterSet& iConfig) { +PFDisplacedVertexProducer::PFDisplacedVertexProducer(const edm::ParameterSet& iConfig) + : magFieldToken_(esConsumes()), + globTkGeomToken_(esConsumes()), + tkerTopoToken_(esConsumes()), + tkerGeomToken_(esConsumes()) { // --- Setup input collection names --- // inputTagVertexCandidates_ = @@ -91,18 +83,10 @@ void PFDisplacedVertexProducer::produce(Event& iEvent, const EventSetup& iSetup) // Prepare useful information for the Finder - ESHandle magField; - iSetup.get().get(magField); - const MagneticField* theMagField = magField.product(); - - ESHandle globTkGeomHandle; - iSetup.get().get(globTkGeomHandle); - - ESHandle tkerTopoHandle; - iSetup.get().get(tkerTopoHandle); - - ESHandle tkerGeomHandle; - iSetup.get().get(tkerGeomHandle); + auto const& theMagField = &iSetup.getData(magFieldToken_); + auto const& globTkGeom = &iSetup.getData(globTkGeomToken_); + auto const& tkerTopo = &iSetup.getData(tkerTopoToken_); + auto const& tkerGeom = &iSetup.getData(tkerGeomToken_); Handle vertexCandidates; iEvent.getByToken(inputTagVertexCandidates_, vertexCandidates); @@ -114,8 +98,7 @@ void PFDisplacedVertexProducer::produce(Event& iEvent, const EventSetup& iSetup) iEvent.getByToken(inputTagBeamSpot_, beamSpotHandle); // Fill useful event information for the Finder - pfDisplacedVertexFinder_.setEdmParameters( - theMagField, globTkGeomHandle, tkerTopoHandle.product(), tkerGeomHandle.product()); + pfDisplacedVertexFinder_.setEdmParameters(theMagField, globTkGeom, tkerTopo, tkerGeom); pfDisplacedVertexFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle); pfDisplacedVertexFinder_.setInput(vertexCandidates); diff --git a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.h b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.h index 60c9e622fda3b..a6116a2fa08c7 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.h +++ b/RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexProducer.h @@ -5,11 +5,15 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "RecoParticleFlow/PFTracking/interface/PFDisplacedVertexFinder.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" +#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" /**\class PFDisplacedVertexProducer \brief Producer for DisplacedVertices @@ -40,6 +44,11 @@ class PFDisplacedVertexProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT inputTagMainVertex_; edm::EDGetTokenT inputTagBeamSpot_; + const edm::ESGetToken magFieldToken_; + const edm::ESGetToken globTkGeomToken_; + const edm::ESGetToken tkerTopoToken_; + const edm::ESGetToken tkerGeomToken_; + /// verbose ? bool verbose_; diff --git a/RecoParticleFlow/PFTracking/plugins/PFElecTkProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFElecTkProducer.cc index e9230587e88a6..d066241913ed5 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFElecTkProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFElecTkProducer.cc @@ -132,6 +132,10 @@ class PFElecTkProducer final : public edm::stream::EDProducer magFieldToken_; + const edm::ESGetToken tkerGeomToken_; + const edm::ESGetToken transientTrackToken_; + ///PFTrackTransformer std::unique_ptr pfTransformer_; MultiTrajectoryStateTransform mtsTransform_; @@ -172,7 +176,10 @@ using namespace edm; using namespace reco; PFElecTkProducer::PFElecTkProducer(const ParameterSet& iConfig, const convbremhelpers::HeavyObjectCache*) - : conf_(iConfig) { + : conf_(iConfig), + magFieldToken_(esConsumes()), + tkerGeomToken_(esConsumes()), + transientTrackToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { gsfTrackLabel_ = consumes(iConfig.getParameter("GsfTrackModuleLabel")); pfTrackLabel_ = consumes(iConfig.getParameter("PFRecTrackLabel")); @@ -1104,19 +1111,14 @@ bool PFElecTkProducer::isInnerMostWithLostHits(const reco::GsfTrackRef& nGsfTrac // ------------ method called once each job just before starting event loop ------------ void PFElecTkProducer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); - - ESHandle tracker; - iSetup.get().get(tracker); + auto const& magneticField = &iSetup.getData(magFieldToken_); + auto const& tracker = &iSetup.getData(tkerGeomToken_); - mtsTransform_ = MultiTrajectoryStateTransform(tracker.product(), magneticField.product()); + mtsTransform_ = MultiTrajectoryStateTransform(tracker, magneticField); pfTransformer_ = std::make_unique(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); - edm::ESHandle builder; - iSetup.get().get("TransientTrackBuilder", builder); - TransientTrackBuilder thebuilder = *(builder.product()); + TransientTrackBuilder thebuilder = iSetup.getData(transientTrackToken_); convBremFinder_ = std::make_unique(thebuilder, mvaConvBremFinderIDBarrelLowPt_, diff --git a/RecoParticleFlow/PFTracking/plugins/PFNuclearProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFNuclearProducer.cc index e61abcf238da0..7d1d2573eb8f1 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFNuclearProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFNuclearProducer.cc @@ -3,11 +3,11 @@ #include "RecoParticleFlow/PFTracking/interface/PFTrackTransformer.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + using namespace std; using namespace edm; -PFNuclearProducer::PFNuclearProducer(const ParameterSet& iConfig) : pfTransformer_(nullptr) { +PFNuclearProducer::PFNuclearProducer(const ParameterSet& iConfig) + : pfTransformer_(nullptr), magneticFieldToken_(esConsumes()) { produces(); produces(); @@ -66,8 +66,7 @@ void PFNuclearProducer::produce(Event& iEvent, const EventSetup& iSetup) { // ------------ method called once each job just before starting event loop ------------ void PFNuclearProducer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); + auto const& magneticField = &iSetup.getData(magneticFieldToken_); pfTransformer_ = new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); pfTransformer_->OnlyProp(); } diff --git a/RecoParticleFlow/PFTracking/plugins/PFTrackProducer.cc b/RecoParticleFlow/PFTracking/plugins/PFTrackProducer.cc index 623fea186ca94..7b15a8fd7414c 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFTrackProducer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFTrackProducer.cc @@ -9,18 +9,17 @@ #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "DataFormats/MuonReco/interface/Muon.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/IPTools/interface/IPTools.h" #include "DataFormats/VertexReco/interface/Vertex.h" using namespace std; using namespace edm; using namespace reco; -PFTrackProducer::PFTrackProducer(const ParameterSet& iConfig) : pfTransformer_() { +PFTrackProducer::PFTrackProducer(const ParameterSet& iConfig) + : transientTrackToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + magneticFieldToken_(esConsumes()), + pfTransformer_() { produces(); std::vector tags = iConfig.getParameter >("TkColList"); @@ -77,9 +76,8 @@ void PFTrackProducer::produce(Event& iEvent, const EventSetup& iSetup) { dummy = reco::Vertex(p, e, 0, 0, 0); } - edm::ESHandle builder; - iSetup.get().get("TransientTrackBuilder", builder); - TransientTrackBuilder thebuilder = *(builder.product()); + //setup transient track builder + TransientTrackBuilder const& thebuilder = iSetup.getData(transientTrackToken_); // read muon collection Handle recMuons; @@ -202,9 +200,8 @@ void PFTrackProducer::produce(Event& iEvent, const EventSetup& iSetup) { // ------------ method called once each job just before starting event loop ------------ void PFTrackProducer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); - pfTransformer_ = std::make_unique(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); + auto const& magneticField = iSetup.getData(magneticFieldToken_); + pfTransformer_ = std::make_unique(math::XYZVector(magneticField.inTesla(GlobalPoint(0, 0, 0)))); if (!trajinev_) pfTransformer_->OnlyProp(); } diff --git a/RecoParticleFlow/PFTracking/plugins/PFV0Producer.cc b/RecoParticleFlow/PFTracking/plugins/PFV0Producer.cc index 4eb0845a324dd..02e6acb50141f 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFV0Producer.cc +++ b/RecoParticleFlow/PFTracking/plugins/PFV0Producer.cc @@ -6,13 +6,12 @@ #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "RecoParticleFlow/PFTracking/interface/PFTrackTransformer.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" using namespace std; using namespace edm; using namespace reco; -PFV0Producer::PFV0Producer(const ParameterSet& iConfig) : pfTransformer_(nullptr) { +PFV0Producer::PFV0Producer(const ParameterSet& iConfig) + : pfTransformer_(nullptr), magneticFieldToken_(esConsumes()) { produces(); produces(); @@ -67,8 +66,7 @@ void PFV0Producer::produce(Event& iEvent, const EventSetup& iSetup) { // ------------ method called once each job just before starting event loop ------------ void PFV0Producer::beginRun(const edm::Run& run, const EventSetup& iSetup) { - ESHandle magneticField; - iSetup.get().get(magneticField); + auto const& magneticField = &iSetup.getData(magneticFieldToken_); pfTransformer_ = new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0, 0, 0)))); pfTransformer_->OnlyProp(); } diff --git a/RecoParticleFlow/PFTracking/plugins/PFV0Producer.h b/RecoParticleFlow/PFTracking/plugins/PFV0Producer.h index c72c0d2eeeca0..746a1bd5a7006 100644 --- a/RecoParticleFlow/PFTracking/plugins/PFV0Producer.h +++ b/RecoParticleFlow/PFTracking/plugins/PFV0Producer.h @@ -8,6 +8,8 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "DataFormats/ParticleFlowReco/interface/PFV0Fwd.h" #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" class PFTrackTransformer; class PFV0Producer : public edm::stream::EDProducer<> { @@ -28,5 +30,7 @@ class PFV0Producer : public edm::stream::EDProducer<> { ///PFTrackTransformer PFTrackTransformer *pfTransformer_; std::vector > V0list_; + + const edm::ESGetToken magneticFieldToken_; }; #endif diff --git a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h index ee5065e81fc45..87e93e6f0bd05 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h @@ -45,7 +45,7 @@ __global__ void kernel_BLFastFit(Tuples const *__restrict__ foundNtuplets, #ifdef BROKENLINE_DEBUG if (0 == local_start) { - printf("%d total Ntuple\n", foundNtuplets->nbins()); + printf("%d total Ntuple\n", foundNtuplets->nOnes()); printf("%d Ntuple of size %d for %d hits to fit\n", tupleMultiplicity->size(nHits), nHits, hitsInFit); } #endif @@ -58,7 +58,7 @@ __global__ void kernel_BLFastFit(Tuples const *__restrict__ foundNtuplets, // get it from the ntuple container (one to one to helix) auto tkid = *(tupleMultiplicity->begin(nHits) + tuple_idx); - assert(tkid < foundNtuplets->nbins()); + assert(tkid < foundNtuplets->nOnes()); assert(foundNtuplets->size(tkid) == nHits); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h index 5342141d2c9e4..8ea536465814c 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h @@ -74,8 +74,7 @@ namespace caConstants { using OuterHitOfCell = cms::cuda::VecArray; using TuplesContainer = cms::cuda::OneToManyAssoc; - using HitToTuple = - cms::cuda::OneToManyAssoc; // 3.5 should be enough + using HitToTuple = cms::cuda::OneToManyAssoc; // 3.5 should be enough using TupleMultiplicity = cms::cuda::OneToManyAssoc; } // namespace caConstants diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cc index 041254e78aa36..5a2157bf87b7c 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cc @@ -84,7 +84,6 @@ void CAHitNtupletGeneratorKernelsCPU::launchKernels(HitsOnCPU const &hh, TkSoA * cms::cuda::launchZero(tuples_d, cudaStream); auto nhits = hh.nHits(); - assert(nhits <= pixelGPUConstants::maxNumberOfHits); // std::cout << "N hits " << nhits << std::endl; // if (nhits<2) std::cout << "too few hits " << nhits << std::endl; @@ -170,12 +169,17 @@ void CAHitNtupletGeneratorKernelsCPU::classifyTuples(HitsOnCPU const &hh, TkSoA kernel_fastDuplicateRemover(device_theCells_.get(), device_nCells_, tuples_d, tracks_d); // fill hit->track "map" - kernel_countHitInTracks(tuples_d, quality_d, device_hitToTuple_.get()); - cms::cuda::launchFinalize(device_hitToTuple_.get(), cudaStream); - kernel_fillHitInTracks(tuples_d, quality_d, device_hitToTuple_.get()); + if (params_.doSharedHitCut_ || params_.doStats_) { + kernel_countHitInTracks(tuples_d, quality_d, device_hitToTuple_.get()); + cms::cuda::launchFinalize(hitToTupleView_, cudaStream); + kernel_fillHitInTracks(tuples_d, quality_d, device_hitToTuple_.get()); + } // remove duplicates (tracks that share a hit) - kernel_tripletCleaner(hh.view(), tuples_d, tracks_d, quality_d, device_hitToTuple_.get()); + if (params_.doSharedHitCut_) { + kernel_sharedHitCleaner( + hh.view(), tuples_d, tracks_d, quality_d, params_.minHitsForSharingCut_, device_hitToTuple_.get()); + } if (params_.doStats_) { // counters (add flag???) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cu b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cu index 179e73f3f23f8..ca334223f8fc7 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cu +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.cu @@ -3,7 +3,7 @@ template <> void CAHitNtupletGeneratorKernelsGPU::fillHitDetIndices(HitsView const *hv, TkSoA *tracks_d, cudaStream_t cudaStream) { auto blockSize = 128; - auto numberOfBlocks = (HitContainer::capacity() + blockSize - 1) / blockSize; + auto numberOfBlocks = (HitContainer::ctCapacity() + blockSize - 1) / blockSize; kernel_fillHitDetIndices<<>>( &tracks_d->hitIndices, hv, &tracks_d->detIndices); @@ -24,10 +24,12 @@ void CAHitNtupletGeneratorKernelsGPU::launchKernels(HitsOnCPU const &hh, TkSoA * cms::cuda::launchZero(tuples_d, cudaStream); auto nhits = hh.nHits(); - assert(nhits <= pixelGPUConstants::maxNumberOfHits); - // std::cout << "N hits " << nhits << std::endl; - // if (nhits<2) std::cout << "too few hits " << nhits << std::endl; +#ifdef NTUPLE_DEBUG + std::cout << "start tuple building. N hits " << nhits << std::endl; + if (nhits < 2) + std::cout << "too few hits " << nhits << std::endl; +#endif // // applying conbinatoric cleaning such as fishbone at this stage is too expensive @@ -95,7 +97,7 @@ void CAHitNtupletGeneratorKernelsGPU::launchKernels(HitsOnCPU const &hh, TkSoA * #endif blockSize = 128; - numberOfBlocks = (HitContainer::totbins() + blockSize - 1) / blockSize; + numberOfBlocks = (HitContainer::ctNOnes() + blockSize - 1) / blockSize; cms::cuda::finalizeBulk<<>>(device_hitTuple_apc_, tuples_d); // remove duplicates (tracks that share a doublet) @@ -136,7 +138,7 @@ void CAHitNtupletGeneratorKernelsGPU::launchKernels(HitsOnCPU const &hh, TkSoA * template <> void CAHitNtupletGeneratorKernelsGPU::buildDoublets(HitsOnCPU const &hh, cudaStream_t stream) { - auto nhits = hh.nHits(); + int32_t nhits = hh.nHits(); #ifdef NTUPLE_DEBUG std::cout << "building Doublets out of " << nhits << " Hits" << std::endl; @@ -148,7 +150,7 @@ void CAHitNtupletGeneratorKernelsGPU::buildDoublets(HitsOnCPU const &hh, cudaStr #endif // in principle we can use "nhits" to heuristically dimension the workspace... - device_isOuterHitOfCell_ = cms::cuda::make_device_unique(std::max(1U, nhits), stream); + device_isOuterHitOfCell_ = cms::cuda::make_device_unique(std::max(1, nhits), stream); assert(device_isOuterHitOfCell_.get()); cellStorage_ = cms::cuda::make_device_unique( @@ -162,7 +164,7 @@ void CAHitNtupletGeneratorKernelsGPU::buildDoublets(HitsOnCPU const &hh, cudaStr { int threadsPerBlock = 128; // at least one block! - int blocks = (std::max(1U, nhits) + threadsPerBlock - 1) / threadsPerBlock; + int blocks = (std::max(1, nhits) + threadsPerBlock - 1) / threadsPerBlock; gpuPixelDoublets::initDoublets<<>>(device_isOuterHitOfCell_.get(), nhits, device_theCellNeighbors_.get(), @@ -225,6 +227,8 @@ void CAHitNtupletGeneratorKernelsGPU::classifyTuples(HitsOnCPU const &hh, TkSoA auto const *tuples_d = &tracks_d->hitIndices; auto *quality_d = tracks_d->qualityData(); + int32_t nhits = hh.nHits(); + auto blockSize = 64; // classify tracks based on kinematics @@ -245,29 +249,38 @@ void CAHitNtupletGeneratorKernelsGPU::classifyTuples(HitsOnCPU const &hh, TkSoA kernel_fastDuplicateRemover<<>>( device_theCells_.get(), device_nCells_, tuples_d, tracks_d); cudaCheck(cudaGetLastError()); +#ifdef GPU_DEBUG + cudaCheck(cudaDeviceSynchronize()); +#endif if (params_.minHitsPerNtuplet_ < 4 || params_.doStats_) { // fill hit->track "map" + assert(hitToTupleView_.offSize > nhits); numberOfBlocks = nQuadrupletBlocks(blockSize); kernel_countHitInTracks<<>>( tuples_d, quality_d, device_hitToTuple_.get()); cudaCheck(cudaGetLastError()); - cms::cuda::launchFinalize(device_hitToTuple_.get(), cudaStream); + assert((hitToTupleView_.assoc == device_hitToTuple_.get()) && + (hitToTupleView_.offStorage == device_hitToTupleStorage_.get()) && (hitToTupleView_.offSize > 0)); + cms::cuda::launchFinalize(hitToTupleView_, cudaStream); cudaCheck(cudaGetLastError()); kernel_fillHitInTracks<<>>(tuples_d, quality_d, device_hitToTuple_.get()); cudaCheck(cudaGetLastError()); +#ifdef GPU_DEBUG + cudaCheck(cudaDeviceSynchronize()); +#endif } - if (params_.minHitsPerNtuplet_ < 4) { + + if (params_.doSharedHitCut_) { // remove duplicates (tracks that share a hit) - numberOfBlocks = (HitToTuple::capacity() + blockSize - 1) / blockSize; - kernel_tripletCleaner<<>>( - hh.view(), tuples_d, tracks_d, quality_d, device_hitToTuple_.get()); + numberOfBlocks = (hitToTupleView_.offSize + blockSize - 1) / blockSize; + kernel_sharedHitCleaner<<>>( + hh.view(), tuples_d, tracks_d, quality_d, params_.minHitsForSharingCut_, device_hitToTuple_.get()); cudaCheck(cudaGetLastError()); } if (params_.doStats_) { - auto nhits = hh.nHits(); - numberOfBlocks = (std::max(nhits, params_.maxNumberOfDoublets_) + blockSize - 1) / blockSize; + numberOfBlocks = (std::max(nhits, int(params_.maxNumberOfDoublets_)) + blockSize - 1) / blockSize; kernel_checkOverflows<<>>(tuples_d, device_tupleMultiplicity_.get(), device_hitToTuple_.get(), @@ -285,7 +298,7 @@ void CAHitNtupletGeneratorKernelsGPU::classifyTuples(HitsOnCPU const &hh, TkSoA if (params_.doStats_) { // counters (add flag???) - numberOfBlocks = (HitToTuple::capacity() + blockSize - 1) / blockSize; + numberOfBlocks = (hitToTupleView_.offSize + blockSize - 1) / blockSize; kernel_doStatsForHitInTracks<<>>(device_hitToTuple_.get(), counters_); cudaCheck(cudaGetLastError()); numberOfBlocks = (3 * caConstants::maxNumberOfQuadruplets / 4 + blockSize - 1) / blockSize; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.h index d1a9f3d13a67f..f5c2755ea8ac6 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernels.h @@ -1,6 +1,8 @@ #ifndef RecoPixelVertexing_PixelTriplets_plugins_CAHitNtupletGeneratorKernels_h #define RecoPixelVertexing_PixelTriplets_plugins_CAHitNtupletGeneratorKernels_h +// #define GPU_DEBUG + #include "CUDADataFormats/Track/interface/PixelTrackHeterogeneous.h" #include "GPUCACell.h" @@ -54,6 +56,7 @@ namespace cAHitNtupletGenerator { Params(bool onGPU, uint32_t minHitsPerNtuplet, uint32_t maxNumberOfDoublets, + uint16_t minHitsForSharingCuts, bool useRiemannFit, bool fit5as4, bool includeJumpingForwardDoublets, @@ -64,16 +67,19 @@ namespace cAHitNtupletGenerator { bool doClusterCut, bool doZ0Cut, bool doPtCut, + bool doSharedHitCut, float ptmin, float CAThetaCutBarrel, float CAThetaCutForward, float hardCurvCut, float dcaCutInnerTriplet, float dcaCutOuterTriplet, + QualityCuts const& cuts) : onGPU_(onGPU), minHitsPerNtuplet_(minHitsPerNtuplet), maxNumberOfDoublets_(maxNumberOfDoublets), + minHitsForSharingCut_(minHitsForSharingCuts), useRiemannFit_(useRiemannFit), fit5as4_(fit5as4), includeJumpingForwardDoublets_(includeJumpingForwardDoublets), @@ -84,6 +90,7 @@ namespace cAHitNtupletGenerator { doClusterCut_(doClusterCut), doZ0Cut_(doZ0Cut), doPtCut_(doPtCut), + doSharedHitCut_(doSharedHitCut), ptmin_(ptmin), CAThetaCutBarrel_(CAThetaCutBarrel), CAThetaCutForward_(CAThetaCutForward), @@ -95,6 +102,7 @@ namespace cAHitNtupletGenerator { const bool onGPU_; const uint32_t minHitsPerNtuplet_; const uint32_t maxNumberOfDoublets_; + const uint16_t minHitsForSharingCut_; const bool useRiemannFit_; const bool fit5as4_; const bool includeJumpingForwardDoublets_; @@ -105,6 +113,7 @@ namespace cAHitNtupletGenerator { const bool doClusterCut_; const bool doZ0Cut_; const bool doPtCut_; + const bool doSharedHitCut_; const float ptmin_; const float CAThetaCutBarrel_; const float CAThetaCutForward_; @@ -172,7 +181,7 @@ class CAHitNtupletGeneratorKernels { void fillHitDetIndices(HitsView const* hv, TkSoA* tuples_d, cudaStream_t cudaStream); void buildDoublets(HitsOnCPU const& hh, cudaStream_t stream); - void allocateOnGPU(cudaStream_t stream); + void allocateOnGPU(int32_t nHits, cudaStream_t stream); void cleanup(cudaStream_t cudaStream); static void printCounters(Counters const* counters); @@ -193,6 +202,9 @@ class CAHitNtupletGeneratorKernels { uint32_t* device_nCells_ = nullptr; unique_ptr device_hitToTuple_; + unique_ptr device_hitToTupleStorage_; + HitToTuple::View hitToTupleView_; + cms::cuda::AtomicPairCounter* device_hitToTuple_apc_ = nullptr; cms::cuda::AtomicPairCounter* device_hitTuple_apc_ = nullptr; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsAlloc.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsAlloc.h index 1d19aa43d6e1b..5978ef8851c73 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsAlloc.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsAlloc.h @@ -4,9 +4,9 @@ template <> #ifdef __CUDACC__ -void CAHitNtupletGeneratorKernelsGPU::allocateOnGPU(cudaStream_t stream) { +void CAHitNtupletGeneratorKernelsGPU::allocateOnGPU(int32_t nHits, cudaStream_t stream) { #else -void CAHitNtupletGeneratorKernelsCPU::allocateOnGPU(cudaStream_t stream) { +void CAHitNtupletGeneratorKernelsCPU::allocateOnGPU(int32_t nHits, cudaStream_t stream) { #endif ////////////////////////////////////////////////////////// // ALLOCATIONS FOR THE INTERMEDIATE RESULTS (STAYS ON WORKER) @@ -15,7 +15,17 @@ void CAHitNtupletGeneratorKernelsCPU::allocateOnGPU(cudaStream_t stream) { device_theCellNeighbors_ = Traits::template make_unique(stream); device_theCellTracks_ = Traits::template make_unique(stream); +#ifdef GPU_DEBUG + std::cout << "Allocation for tuple building. N hits " << nHits << std::endl; +#endif + + nHits++; // storage requires one more counter; + assert(nHits > 0); device_hitToTuple_ = Traits::template make_unique(stream); + device_hitToTupleStorage_ = Traits::template make_unique(nHits, stream); + hitToTupleView_.assoc = device_hitToTuple_.get(); + hitToTupleView_.offStorage = device_hitToTupleStorage_.get(); + hitToTupleView_.offSize = nHits; device_tupleMultiplicity_ = Traits::template make_unique(stream); @@ -25,11 +35,16 @@ void CAHitNtupletGeneratorKernelsCPU::allocateOnGPU(cudaStream_t stream) { device_hitToTuple_apc_ = (cms::cuda::AtomicPairCounter*)device_storage_.get() + 1; device_nCells_ = (uint32_t*)(device_storage_.get() + 2); + // FIXME: consider collapsing these 3 in one adhoc kernel if constexpr (std::is_same::value) { cudaCheck(cudaMemsetAsync(device_nCells_, 0, sizeof(uint32_t), stream)); } else { *device_nCells_ = 0; } cms::cuda::launchZero(device_tupleMultiplicity_.get(), stream); - cms::cuda::launchZero(device_hitToTuple_.get(), stream); // we may wish to keep it in the edm... + cms::cuda::launchZero(hitToTupleView_, stream); // we may wish to keep it in the edm +#ifdef GPU_DEBUG + cudaDeviceSynchronize(); + cudaCheck(cudaGetLastError()); +#endif } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h index 7c0cec51b8057..550541fdca6fb 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h @@ -3,6 +3,7 @@ // // #define NTUPLE_DEBUG +// #define GPU_DEBUG #include #include @@ -38,7 +39,7 @@ __global__ void kernel_checkOverflows(HitContainer const *foundNtuplets, gpuPixelDoublets::CellNeighborsVector const *cellNeighbors, gpuPixelDoublets::CellTracksVector const *cellTracks, GPUCACell::OuterHitOfCell const *__restrict__ isOuterHitOfCell, - uint32_t nHits, + int32_t nHits, uint32_t maxNumberOfDoublets, CAHitNtupletGeneratorKernelsGPU::Counters *counters) { auto first = threadIdx.x + blockIdx.x * blockDim.x; @@ -55,23 +56,24 @@ __global__ void kernel_checkOverflows(HitContainer const *foundNtuplets, #ifdef NTUPLE_DEBUG if (0 == first) { - printf("number of found cells %d, found tuples %d with total hits %d out of %d\n", + printf("number of found cells %d, found tuples %d with total hits %d out of %d %d\n", *nCells, apc->get().m, apc->get().n, - nHits); + nHits, + hitToTuple->totOnes()); if (apc->get().m < caConstants::maxNumberOfQuadruplets()) { assert(foundNtuplets->size(apc->get().m) == 0); assert(foundNtuplets->size() == apc->get().n); } } - for (int idx = first, nt = foundNtuplets->nbins(); idx < nt; idx += gridDim.x * blockDim.x) { + for (int idx = first, nt = foundNtuplets->nOnes(); idx < nt; idx += gridDim.x * blockDim.x) { if (foundNtuplets->size(idx) > 5) printf("ERROR %d, %d\n", idx, foundNtuplets->size(idx)); assert(foundNtuplets->size(idx) < 6); for (auto ih = foundNtuplets->begin(idx); ih != foundNtuplets->end(idx); ++ih) - assert(*ih < nHits); + assert(int(*ih) < nHits); } #endif @@ -84,6 +86,8 @@ __global__ void kernel_checkOverflows(HitContainer const *foundNtuplets, printf("cellNeighbors overflow\n"); if (cellTracks && cellTracks->full()) printf("cellTracks overflow\n"); + if (int(hitToTuple->nOnes()) < nHits) + printf("ERROR hitToTuple overflow %d %d\n", hitToTuple->nOnes(), nHits); } for (int idx = first, nt = (*nCells); idx < nt; idx += gridDim.x * blockDim.x) { @@ -302,7 +306,7 @@ __global__ void kernel_countMultiplicity(HitContainer const *__restrict__ foundN Quality const *__restrict__ quality, caConstants::TupleMultiplicity *tupleMultiplicity) { auto first = blockIdx.x * blockDim.x + threadIdx.x; - for (int it = first, nt = foundNtuplets->nbins(); it < nt; it += gridDim.x * blockDim.x) { + for (int it = first, nt = foundNtuplets->nOnes(); it < nt; it += gridDim.x * blockDim.x) { auto nhits = foundNtuplets->size(it); if (nhits < 3) continue; @@ -312,7 +316,7 @@ __global__ void kernel_countMultiplicity(HitContainer const *__restrict__ foundN if (nhits > 5) printf("wrong mult %d %d\n", it, nhits); assert(nhits < 8); - tupleMultiplicity->countDirect(nhits); + tupleMultiplicity->count(nhits); } } @@ -320,7 +324,7 @@ __global__ void kernel_fillMultiplicity(HitContainer const *__restrict__ foundNt Quality const *__restrict__ quality, caConstants::TupleMultiplicity *tupleMultiplicity) { auto first = blockIdx.x * blockDim.x + threadIdx.x; - for (int it = first, nt = foundNtuplets->nbins(); it < nt; it += gridDim.x * blockDim.x) { + for (int it = first, nt = foundNtuplets->nOnes(); it < nt; it += gridDim.x * blockDim.x) { auto nhits = foundNtuplets->size(it); if (nhits < 3) continue; @@ -330,7 +334,7 @@ __global__ void kernel_fillMultiplicity(HitContainer const *__restrict__ foundNt if (nhits > 5) printf("wrong mult %d %d\n", it, nhits); assert(nhits < 8); - tupleMultiplicity->fillDirect(nhits, it); + tupleMultiplicity->fill(nhits, it); } } @@ -339,7 +343,7 @@ __global__ void kernel_classifyTracks(HitContainer const *__restrict__ tuples, CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts, Quality *__restrict__ quality) { int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int it = first, nt = tuples->nbins(); it < nt; it += gridDim.x * blockDim.x) { + for (int it = first, nt = tuples->nOnes(); it < nt; it += gridDim.x * blockDim.x) { auto nhits = tuples->size(it); if (nhits == 0) break; // guard @@ -377,7 +381,7 @@ __global__ void kernel_classifyTracks(HitContainer const *__restrict__ tuples, (cuts.chi2Coeff[0] + pt * (cuts.chi2Coeff[1] + pt * (cuts.chi2Coeff[2] + pt * cuts.chi2Coeff[3]))); // above number were for Quads not normalized so for the time being just multiple by ndof for Quads (triplets to be understood) if (3.f * tracks->chi2(it) >= chi2Cut) { -#ifdef NTUPLE_DEBUG +#ifdef NTUPLE_FIT_DEBUG printf("Bad fit %d size %d pt %f eta %f chi2 %f\n", it, tuples->size(it), @@ -406,7 +410,7 @@ __global__ void kernel_doStatsForTracks(HitContainer const *__restrict__ tuples, Quality const *__restrict__ quality, CAHitNtupletGeneratorKernelsGPU::Counters *counters) { int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int idx = first, ntot = tuples->nbins(); idx < ntot; idx += gridDim.x * blockDim.x) { + for (int idx = first, ntot = tuples->nOnes(); idx < ntot; idx += gridDim.x * blockDim.x) { if (tuples->size(idx) == 0) break; //guard if (quality[idx] != pixelTrack::Quality::loose) @@ -419,13 +423,13 @@ __global__ void kernel_countHitInTracks(HitContainer const *__restrict__ tuples, Quality const *__restrict__ quality, CAHitNtupletGeneratorKernelsGPU::HitToTuple *hitToTuple) { int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int idx = first, ntot = tuples->nbins(); idx < ntot; idx += gridDim.x * blockDim.x) { + for (int idx = first, ntot = tuples->nOnes(); idx < ntot; idx += gridDim.x * blockDim.x) { if (tuples->size(idx) == 0) break; // guard if (quality[idx] != pixelTrack::Quality::loose) continue; for (auto h = tuples->begin(idx); h != tuples->end(idx); ++h) - hitToTuple->countDirect(*h); + hitToTuple->count(*h); } } @@ -433,13 +437,13 @@ __global__ void kernel_fillHitInTracks(HitContainer const *__restrict__ tuples, Quality const *__restrict__ quality, CAHitNtupletGeneratorKernelsGPU::HitToTuple *hitToTuple) { int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int idx = first, ntot = tuples->nbins(); idx < ntot; idx += gridDim.x * blockDim.x) { + for (int idx = first, ntot = tuples->nOnes(); idx < ntot; idx += gridDim.x * blockDim.x) { if (tuples->size(idx) == 0) break; // guard if (quality[idx] != pixelTrack::Quality::loose) continue; for (auto h = tuples->begin(idx); h != tuples->end(idx); ++h) - hitToTuple->fillDirect(*h, idx); + hitToTuple->fill(*h, idx); } } @@ -448,15 +452,15 @@ __global__ void kernel_fillHitDetIndices(HitContainer const *__restrict__ tuples HitContainer *__restrict__ hitDetIndices) { int first = blockDim.x * blockIdx.x + threadIdx.x; // copy offsets - for (int idx = first, ntot = tuples->totbins(); idx < ntot; idx += gridDim.x * blockDim.x) { + for (int idx = first, ntot = tuples->totOnes(); idx < ntot; idx += gridDim.x * blockDim.x) { hitDetIndices->off[idx] = tuples->off[idx]; } // fill hit indices auto const &hh = *hhp; auto nhits = hh.nHits(); for (int idx = first, ntot = tuples->size(); idx < ntot; idx += gridDim.x * blockDim.x) { - assert(tuples->bins[idx] < nhits); - hitDetIndices->bins[idx] = hh.detectorIndex(tuples->bins[idx]); + assert(tuples->content[idx] < nhits); + hitDetIndices->content[idx] = hh.detectorIndex(tuples->content[idx]); } } @@ -464,7 +468,7 @@ __global__ void kernel_doStatsForHitInTracks(CAHitNtupletGeneratorKernelsGPU::Hi CAHitNtupletGeneratorKernelsGPU::Counters *counters) { auto &c = *counters; int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int idx = first, ntot = hitToTuple->nbins(); idx < ntot; idx += gridDim.x * blockDim.x) { + for (int idx = first, ntot = hitToTuple->nOnes(); idx < ntot; idx += gridDim.x * blockDim.x) { if (hitToTuple->size(idx) == 0) continue; // SHALL NOT BE break atomicAdd(&c.nUsedHits, 1); @@ -473,11 +477,12 @@ __global__ void kernel_doStatsForHitInTracks(CAHitNtupletGeneratorKernelsGPU::Hi } } -__global__ void kernel_tripletCleaner(TrackingRecHit2DSOAView const *__restrict__ hhp, - HitContainer const *__restrict__ ptuples, - TkSoA const *__restrict__ ptracks, - Quality *__restrict__ quality, - CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ phitToTuple) { +__global__ void kernel_sharedHitCleaner(TrackingRecHit2DSOAView const *__restrict__ hhp, + HitContainer const *__restrict__ ptuples, + TkSoA const *__restrict__ ptracks, + Quality *__restrict__ quality, + uint16_t nmin, + CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ phitToTuple) { constexpr auto bad = pixelTrack::Quality::bad; constexpr auto dup = pixelTrack::Quality::dup; // constexpr auto loose = trackQuality::loose; @@ -486,8 +491,11 @@ __global__ void kernel_tripletCleaner(TrackingRecHit2DSOAView const *__restrict_ auto const &foundNtuplets = *ptuples; auto const &tracks = *ptracks; + auto const &hh = *hhp; + int l1end = hh.hitsLayerStart()[1]; + int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int idx = first, ntot = hitToTuple.nbins(); idx < ntot; idx += gridDim.x * blockDim.x) { + for (int idx = first, ntot = hitToTuple.nOnes(); idx < ntot; idx += gridDim.x * blockDim.x) { if (hitToTuple.size(idx) < 2) continue; @@ -503,6 +511,11 @@ __global__ void kernel_tripletCleaner(TrackingRecHit2DSOAView const *__restrict_ // kill all tracks shorter than maxHn (only triplets???) for (auto it = hitToTuple.begin(idx); it != hitToTuple.end(idx); ++it) { uint32_t nh = foundNtuplets.size(*it); + + //checking if shared hit is on bpix1 and if the tuple is short enough + if (idx < l1end and nh > nmin) + continue; + if (maxNh != nh) quality[*it] = dup; } @@ -531,12 +544,12 @@ __global__ void kernel_print_found_ntuplets(TrackingRecHit2DSOAView const *__res TkSoA const *__restrict__ ptracks, Quality const *__restrict__ quality, CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ phitToTuple, - uint32_t maxPrint, + int32_t maxPrint, int iev) { auto const &foundNtuplets = *ptuples; auto const &tracks = *ptracks; int first = blockDim.x * blockIdx.x + threadIdx.x; - for (int i = first, np = std::min(maxPrint, foundNtuplets.nbins()); i < np; i += blockDim.x * gridDim.x) { + for (int i = first, np = std::min(maxPrint, foundNtuplets.nOnes()); i < np; i += blockDim.x * gridDim.x) { auto nh = foundNtuplets.size(i); if (nh < 3) continue; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc index c2c7c2b869752..3f5ba1d04e7db 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorOnGPU.cc @@ -2,6 +2,8 @@ // Original Author: Felice Pantaleo, CERN // +// #define GPU_DEBUG + #include #include #include @@ -57,6 +59,7 @@ CAHitNtupletGeneratorOnGPU::CAHitNtupletGeneratorOnGPU(const edm::ParameterSet& : m_params(cfg.getParameter("onGPU"), cfg.getParameter("minHitsPerNtuplet"), cfg.getParameter("maxNumberOfDoublets"), + cfg.getParameter("minHitsForSharingCut"), cfg.getParameter("useRiemannFit"), cfg.getParameter("fit5as4"), cfg.getParameter("includeJumpingForwardDoublets"), @@ -67,6 +70,7 @@ CAHitNtupletGeneratorOnGPU::CAHitNtupletGeneratorOnGPU(const edm::ParameterSet& cfg.getParameter("doClusterCut"), cfg.getParameter("doZ0Cut"), cfg.getParameter("doPtCut"), + cfg.getParameter("doSharedHitCut"), cfg.getParameter("ptmin"), cfg.getParameter("CAThetaCutBarrel"), cfg.getParameter("CAThetaCutForward"), @@ -141,12 +145,15 @@ void CAHitNtupletGeneratorOnGPU::fillDescriptions(edm::ParameterSetDescription& desc.add("fillStatistics", false); desc.add("minHitsPerNtuplet", 4); desc.add("maxNumberOfDoublets", caConstants::maxNumberOfDoublets); + desc.add("minHitsForSharingCut", 5) + ->setComment("Maximum number of hits in a tuple to clean also if the shared hit is on bpx1"); desc.add("includeJumpingForwardDoublets", false); desc.add("fit5as4", true); desc.add("doClusterCut", true); desc.add("doZ0Cut", true); desc.add("doPtCut", true); desc.add("useRiemannFit", false)->setComment("true for Riemann, false for BrokenLine"); + desc.add("doSharedHitCut", true)->setComment("Sharing hit nTuples cleaning"); edm::ParameterSetDescription trackQualityCuts; trackQualityCuts.add("chi2MaxPt", 10.)->setComment("max pT used to determine the pT-dependent chi2 cut"); @@ -174,11 +181,11 @@ PixelTrackHeterogeneous CAHitNtupletGeneratorOnGPU::makeTuplesAsync(TrackingRecH PixelTrackHeterogeneous tracks(cms::cuda::make_device_unique(stream)); auto* soa = tracks.get(); + assert(soa); CAHitNtupletGeneratorKernelsGPU kernels(m_params); kernels.setCounters(m_counters); - - kernels.allocateOnGPU(stream); + kernels.allocateOnGPU(hits_d.nHits(), stream); kernels.buildDoublets(hits_d, stream); kernels.launchKernels(hits_d, soa, stream); @@ -193,6 +200,12 @@ PixelTrackHeterogeneous CAHitNtupletGeneratorOnGPU::makeTuplesAsync(TrackingRecH } kernels.classifyTuples(hits_d, soa, stream); +#ifdef GPU_DEBUG + cudaDeviceSynchronize(); + cudaCheck(cudaGetLastError()); + std::cout << "finished building pixel tracks on GPU" << std::endl; +#endif + return tracks; } @@ -204,7 +217,7 @@ PixelTrackHeterogeneous CAHitNtupletGeneratorOnGPU::makeTuples(TrackingRecHit2DC CAHitNtupletGeneratorKernelsCPU kernels(m_params); kernels.setCounters(m_counters); - kernels.allocateOnGPU(nullptr); + kernels.allocateOnGPU(hits_d.nHits(), nullptr); kernels.buildDoublets(hits_d, nullptr); kernels.launchKernels(hits_d, soa, nullptr); @@ -225,5 +238,9 @@ PixelTrackHeterogeneous CAHitNtupletGeneratorOnGPU::makeTuples(TrackingRecHit2DC kernels.classifyTuples(hits_d, soa, nullptr); +#ifdef GPU_DEBUG + std::cout << "finished building pixel tracks on CPU" << std::endl; +#endif + return tracks; } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/RiemannFitOnGPU.h b/RecoPixelVertexing/PixelTriplets/plugins/RiemannFitOnGPU.h index 5b661bc3be028..926002d674b83 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/RiemannFitOnGPU.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/RiemannFitOnGPU.h @@ -51,7 +51,7 @@ __global__ void kernel_FastFit(Tuples const *__restrict__ foundNtuplets, // get it from the ntuple container (one to one to helix) auto tkid = *(tupleMultiplicity->begin(nHits) + tuple_idx); - assert(tkid < foundNtuplets->nbins()); + assert(tkid < foundNtuplets->nOnes()); assert(foundNtuplets->size(tkid) == nHits); diff --git a/RecoTracker/GeometryESProducer/plugins/TrackerMTDRecoGeometryESProducer.cc b/RecoTracker/GeometryESProducer/plugins/TrackerMTDRecoGeometryESProducer.cc new file mode 100644 index 0000000000000..12ceadaa7270a --- /dev/null +++ b/RecoTracker/GeometryESProducer/plugins/TrackerMTDRecoGeometryESProducer.cc @@ -0,0 +1,70 @@ +#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" +#include "RecoTracker/TkDetLayers/interface/GeometricSearchTrackerBuilder.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h" +#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" +#include "Geometry/Records/interface/MTDTopologyRcd.h" +#include "Geometry/Records/interface/MTDDigiGeometryRecord.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include +#include + +class TrackerMTDRecoGeometryESProducer : public edm::ESProducer { +public: + TrackerMTDRecoGeometryESProducer(const edm::ParameterSet &p); + + std::unique_ptr produce(const TrackerRecoGeometryRecord &); + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + edm::ESGetToken geomToken_; + edm::ESGetToken tTopToken_; + edm::ESGetToken mtdgeomToken_; + edm::ESGetToken mtdTopToken_; + bool usePhase2Stacks_; +}; + +using namespace edm; + +TrackerMTDRecoGeometryESProducer::TrackerMTDRecoGeometryESProducer(const edm::ParameterSet &p) + : usePhase2Stacks_(p.getParameter("usePhase2Stacks")) { + auto c = setWhatProduced(this); + + tTopToken_ = c.consumes(); + geomToken_ = c.consumes(edm::ESInputTag("", p.getUntrackedParameter("trackerGeometryLabel"))); + mtdgeomToken_ = c.consumes(); + mtdTopToken_ = c.consumes(); +} + +std::unique_ptr TrackerMTDRecoGeometryESProducer::produce( + const TrackerRecoGeometryRecord &iRecord) { + TrackerGeometry const &tG = iRecord.get(geomToken_); + MTDGeometry const &mG = iRecord.get(mtdgeomToken_); + + GeometricSearchTrackerBuilder builder; + return std::unique_ptr( + builder.build(tG.trackerDet(), &tG, &iRecord.get(tTopToken_), &mG, &iRecord.get(mtdTopToken_), usePhase2Stacks_)); +} + +void TrackerMTDRecoGeometryESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + + desc.add("usePhase2Stacks", false); + desc.addUntracked("trackerGeometryLabel", ""); + descriptions.addDefault(desc); +} + +DEFINE_FWK_EVENTSETUP_MODULE(TrackerMTDRecoGeometryESProducer); diff --git a/RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py b/RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py new file mode 100644 index 0000000000000..2d8709b2618ae --- /dev/null +++ b/RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +TrackerRecoGeometryESProducer = cms.ESProducer("TrackerMTDRecoGeometryESProducer", + usePhase2Stacks = cms.bool(False) +) + +from Configuration.ProcessModifiers.vectorHits_cff import vectorHits +vectorHits.toModify(TrackerRecoGeometryESProducer, usePhase2Stacks = True) diff --git a/RecoTracker/MkFit/plugins/MkFitOutputConverter.cc b/RecoTracker/MkFit/plugins/MkFitOutputConverter.cc index 87ac3e4023677..b21bc7c35b8b0 100644 --- a/RecoTracker/MkFit/plugins/MkFitOutputConverter.cc +++ b/RecoTracker/MkFit/plugins/MkFitOutputConverter.cc @@ -190,7 +190,8 @@ std::vector MkFitOutputConverter::createDetLayers(const mkfit:: const int subdet, const int layer, const int isStereo, const DetId& detId, const DetLayer* lay) { const int index = lnc.convertLayerNumber(subdet, layer, false, isStereo, isPlusSide(detId)); if (index < 0 or static_cast(index) >= dets.size()) { - throw cms::Exception("LogicError") << "Invalid mkFit layer index " << index << " for DetId " << detId + throw cms::Exception("LogicError") << "Invalid mkFit layer index " << index << " for det rawId " << detId.rawId() + << " " << " subdet " << subdet << " layer " << layer << " isStereo " << isStereo; } dets[index] = lay; diff --git a/RecoTracker/Record/interface/TrackerRecoGeometryRecord.h b/RecoTracker/Record/interface/TrackerRecoGeometryRecord.h index 89d99257f6683..7c7f764c34e41 100644 --- a/RecoTracker/Record/interface/TrackerRecoGeometryRecord.h +++ b/RecoTracker/Record/interface/TrackerRecoGeometryRecord.h @@ -5,11 +5,18 @@ #include "FWCore/Framework/interface/DependentRecordImplementation.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/Records/interface/MTDGeometryRecord.h" +#include "Geometry/Records/interface/MTDDigiGeometryRecord.h" +#include "Geometry/Records/interface/MTDTopologyRcd.h" #include "FWCore/Utilities/interface/mplVector.h" -class TrackerRecoGeometryRecord : public edm::eventsetup::DependentRecordImplementation< - TrackerRecoGeometryRecord, - edm::mpl::Vector > {}; +class TrackerRecoGeometryRecord + : public edm::eventsetup::DependentRecordImplementation > {}; #endif diff --git a/RecoTracker/TkDetLayers/BuildFile.xml b/RecoTracker/TkDetLayers/BuildFile.xml index ac0c879187f94..daee53060a497 100644 --- a/RecoTracker/TkDetLayers/BuildFile.xml +++ b/RecoTracker/TkDetLayers/BuildFile.xml @@ -8,4 +8,5 @@ + diff --git a/RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h b/RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h index 1f50c1c9dd766..53d41ae3b18f2 100644 --- a/RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h +++ b/RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h @@ -4,6 +4,7 @@ #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" #include "TrackingTools/DetLayers/interface/DetLayerGeometry.h" +#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" class TrackerTopology; @@ -26,6 +27,12 @@ class GeometricSearchTracker : public DetLayerGeometry { ~GeometricSearchTracker() override __attribute__((cold)); + void addDetLayerGeometry(); + + void addMTDLayers(const std::vector& btl, + const std::vector& negEtl, + const std::vector& posEtl); + std::vector const& allLayers() const { return theAllLayers; } std::vector const& barrelLayers() const { return theBarrelLayers; } @@ -52,6 +59,9 @@ class GeometricSearchTracker : public DetLayerGeometry { /// obsolete method. Use idToLayer() instead. const DetLayer* detLayer(const DetId& id) const { return idToLayer(id); }; + //Need to make this pointer public so the tracker builder can build the MTD + MTDDetLayerGeometry* mtdDetLayerGeometry; + private: std::vector theAllLayers; std::vector theBarrelLayers; @@ -70,6 +80,12 @@ class GeometricSearchTracker : public DetLayerGeometry { std::vector thePosTidLayers; std::vector thePosTecLayers; + //MTD stuff + std::vector theBTLLayers; + std::vector theETLLayers; + std::vector theNegETLLayers; + std::vector thePosETLLayers; + const TrackerTopology* theTrkTopo; }; diff --git a/RecoTracker/TkDetLayers/interface/GeometricSearchTrackerBuilder.h b/RecoTracker/TkDetLayers/interface/GeometricSearchTrackerBuilder.h index 893f7fdf1b2b9..19c5077180d77 100644 --- a/RecoTracker/TkDetLayers/interface/GeometricSearchTrackerBuilder.h +++ b/RecoTracker/TkDetLayers/interface/GeometricSearchTrackerBuilder.h @@ -6,6 +6,7 @@ #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" class TrackerTopology; +class MTDTopology; /** GeometricSearchTrackerBuilder implementation * @@ -20,6 +21,14 @@ class GeometricSearchTrackerBuilder { const TrackerGeometry* theGeomDetGeometry, const TrackerTopology* tTopo, const bool usePhase2Stacks = false) __attribute__((cold)); + + //This constructor builds also the MTD geometry + GeometricSearchTracker* build(const GeometricDet* theGeometricTracker, + const TrackerGeometry* theGeomDetGeometry, + const TrackerTopology* tTopo, + const MTDGeometry* mtd, + const MTDTopology* mTopo, + const bool usePhase2Stacks = false) __attribute__((cold)); }; #endif diff --git a/RecoTracker/TkDetLayers/src/GeometricSearchTracker.cc b/RecoTracker/TkDetLayers/src/GeometricSearchTracker.cc index ff4a370995734..49af2946cc83d 100644 --- a/RecoTracker/TkDetLayers/src/GeometricSearchTracker.cc +++ b/RecoTracker/TkDetLayers/src/GeometricSearchTracker.cc @@ -78,46 +78,101 @@ GeometricSearchTracker::~GeometricSearchTracker() { #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" const DetLayer* GeometricSearchTracker::idToLayer(const DetId& id) const { - switch (id.subdetId()) { - case StripSubdetector::TIB: - return theTibLayers[theTrkTopo->tibLayer(id) - 1]; - break; - - case StripSubdetector::TOB: - return theTobLayers[theTrkTopo->tobLayer(id) - 1]; - break; - - case StripSubdetector::TID: - if (theTrkTopo->tidSide(id) == 1) { - return theNegTidLayers[theTrkTopo->tidWheel(id) - 1]; - } else if (theTrkTopo->tidSide(id) == 2) { - return thePosTidLayers[theTrkTopo->tidWheel(id) - 1]; - } - break; - - case StripSubdetector::TEC: - if (theTrkTopo->tecSide(id) == 1) { - return theNegTecLayers[theTrkTopo->tecWheel(id) - 1]; - } else if (theTrkTopo->tecSide(id) == 2) { - return thePosTecLayers[theTrkTopo->tecWheel(id) - 1]; - } - break; - - case PixelSubdetector::PixelBarrel: - return thePixelBarrelLayers[theTrkTopo->pxbLayer(id) - 1]; - break; - - case PixelSubdetector::PixelEndcap: - if (theTrkTopo->pxfSide(id) == 1) { - return theNegPixelForwardLayers[theTrkTopo->pxfDisk(id) - 1]; - } else if (theTrkTopo->pxfSide(id) == 2) { - return thePosPixelForwardLayers[theTrkTopo->pxfDisk(id) - 1]; - } - break; - - default: - edm::LogError("TkDetLayers") << "ERROR:layer not found!"; - // throw(something); + //If it's a tracker Det + if (id.det() == DetId::Detector::Tracker) { + switch (id.subdetId()) { + case StripSubdetector::TIB: + return theTibLayers[theTrkTopo->tibLayer(id) - 1]; + break; + + case StripSubdetector::TOB: + return theTobLayers[theTrkTopo->tobLayer(id) - 1]; + break; + + case StripSubdetector::TID: + if (theTrkTopo->tidSide(id) == 1) { + return theNegTidLayers[theTrkTopo->tidWheel(id) - 1]; + } else if (theTrkTopo->tidSide(id) == 2) { + return thePosTidLayers[theTrkTopo->tidWheel(id) - 1]; + } + break; + + case StripSubdetector::TEC: + if (theTrkTopo->tecSide(id) == 1) { + return theNegTecLayers[theTrkTopo->tecWheel(id) - 1]; + } else if (theTrkTopo->tecSide(id) == 2) { + return thePosTecLayers[theTrkTopo->tecWheel(id) - 1]; + } + break; + + case PixelSubdetector::PixelBarrel: + return thePixelBarrelLayers[theTrkTopo->pxbLayer(id) - 1]; + break; + + case PixelSubdetector::PixelEndcap: + if (theTrkTopo->pxfSide(id) == 1) { + return theNegPixelForwardLayers[theTrkTopo->pxfDisk(id) - 1]; + } else if (theTrkTopo->pxfSide(id) == 2) { + return thePosPixelForwardLayers[theTrkTopo->pxfDisk(id) - 1]; + } + break; + + default: + edm::LogError("TkDetLayers") << "ERROR:layer not found!"; + // throw(something); + } + return nullptr; //just to avoid compile warnings + } else if (id.det() == DetId::Forward && id.subdetId() == FastTime) { + //If it's MTD + return mtdDetLayerGeometry->idToLayer(id); } return nullptr; //just to avoid compile warnings } + +void GeometricSearchTracker::addDetLayerGeometry() { mtdDetLayerGeometry = new MTDDetLayerGeometry(); } + +void GeometricSearchTracker::addMTDLayers(const std::vector& btl, + const std::vector& negEtl, + const std::vector& posEtl) { + //Barrel + theBTLLayers.assign(btl.begin(), btl.end()); + theBarrelLayers.insert(theBarrelLayers.end(), theBTLLayers.begin(), theBTLLayers.end()); + //Endcap + theNegETLLayers.assign(negEtl.begin(), negEtl.end()); + thePosETLLayers.assign(posEtl.begin(), posEtl.end()); + theETLLayers.assign(negEtl.begin(), negEtl.end()); + theETLLayers.insert(theETLLayers.end(), posEtl.begin(), posEtl.end()); + theNegForwardLayers.insert(theNegForwardLayers.end(), theNegETLLayers.begin(), theNegETLLayers.end()); + thePosForwardLayers.insert(thePosForwardLayers.end(), thePosETLLayers.begin(), thePosETLLayers.end()); + //Reordering of tracker + MTD layers + theForwardLayers.clear(); + theAllLayers.clear(); + theForwardLayers.assign(theNegForwardLayers.begin(), theNegForwardLayers.end()); + theForwardLayers.insert(theForwardLayers.end(), thePosForwardLayers.begin(), thePosForwardLayers.end()); + theAllLayers.assign(theBarrelLayers.begin(), theBarrelLayers.end()); + theAllLayers.insert(theAllLayers.end(), theForwardLayers.begin(), theForwardLayers.end()); + + // number the layers + int sq = 0; + for (auto l : theAllLayers) + const_cast(*l).setSeqNum(sq++); + + edm::LogInfo("MTDDetLayers") << "------ GeometricSearchTracker+MTD constructed with: ------" + << "\n" + << "n pxlBarLayers: " << this->pixelBarrelLayers().size() << "\n" + << "n tibLayers: " << this->tibLayers().size() << "\n" + << "n tobLayers: " << this->tobLayers().size() << "\n" + << "n negPxlFwdLayers: " << this->negPixelForwardLayers().size() << "\n" + << "n posPxlFwdLayers: " << this->posPixelForwardLayers().size() << "\n" + << "n negTidLayers: " << this->negTidLayers().size() << "\n" + << "n posTidLayers: " << this->posTidLayers().size() << "\n" + << "n negTecLayers: " << this->negTecLayers().size() << "\n" + << "n posTecLayers: " << this->posTecLayers().size() << "\n" + << "n barreLayers: " << this->barrelLayers().size() << "\n" + << "n negforwardLayers: " << this->negForwardLayers().size() << "\n" + << "n posForwardLayers: " << this->posForwardLayers().size() << "\n" + << "n MTDbarrelLayers: " << this->theBTLLayers.size() << "\n" + << "n MTDnegLayers: " << this->theNegETLLayers.size() << "\n" + << "n MTDposLayers: " << this->thePosETLLayers.size() << "\n" + << "\nn Total : " << theAllLayers.size() << std::endl; +} diff --git a/RecoTracker/TkDetLayers/src/GeometricSearchTrackerBuilder.cc b/RecoTracker/TkDetLayers/src/GeometricSearchTrackerBuilder.cc index 51cd455a23717..d19f04bc4ab0b 100644 --- a/RecoTracker/TkDetLayers/src/GeometricSearchTrackerBuilder.cc +++ b/RecoTracker/TkDetLayers/src/GeometricSearchTrackerBuilder.cc @@ -10,18 +10,15 @@ #include "TIDLayerBuilder.h" #include "TECLayerBuilder.h" -#include "Geometry/TrackerGeometryBuilder/interface/trackerHierarchy.h" - #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" - -#include "DataFormats/Common/interface/Trie.h" +#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" using namespace std; -GeometricSearchTracker* GeometricSearchTrackerBuilder::build(const GeometricDet* theGeometricTracker, - const TrackerGeometry* theGeomDetGeometry, - const TrackerTopology* tTopo, +GeometricSearchTracker *GeometricSearchTrackerBuilder::build(const GeometricDet *theGeometricTracker, + const TrackerGeometry *theGeomDetGeometry, + const TrackerTopology *tTopo, const bool usePhase2Stacks) { PixelBarrelLayerBuilder aPixelBarrelLayerBuilder; Phase2OTBarrelLayerBuilder aPhase2OTBarrelLayerBuilder; @@ -33,119 +30,98 @@ GeometricSearchTracker* GeometricSearchTrackerBuilder::build(const GeometricDet* TIDLayerBuilder aTIDLayerBuilder; TECLayerBuilder aTECLayerBuilder; - vector thePxlBarLayers; - vector theTIBLayers; - vector theTOBLayers; - vector theNegPxlFwdLayers; - vector thePosPxlFwdLayers; - vector theNegTIDLayers; - vector thePosTIDLayers; - vector theNegTECLayers; - vector thePosTECLayers; + vector thePxlBarLayers; + vector theTIBLayers; + vector theTOBLayers; + vector theNegPxlFwdLayers; + vector thePosPxlFwdLayers; + vector theNegTIDLayers; + vector thePosTIDLayers; + vector theNegTECLayers; + vector thePosTECLayers; bool useBrothers = !usePhase2Stacks; - vector theGeometricDetLayers = theGeometricTracker->components(); - for (vector::const_iterator it = theGeometricDetLayers.begin(); - it != theGeometricDetLayers.end(); - it++) { - if ((*it)->type() == GeometricDet::PixelBarrel) { - vector thePxlBarGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = thePxlBarGeometricDetLayers.begin(); - it2 != thePxlBarGeometricDetLayers.end(); - it2++) { - thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(*it2, theGeomDetGeometry)); + auto const &theGeometricDetLayers = theGeometricTracker->components(); + for (auto const &theGeomDetLayer : theGeometricDetLayers) { + if (theGeomDetLayer->type() == GeometricDet::PixelBarrel) { + auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) { + thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::PixelPhase1Barrel) { - vector thePxlBarGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = thePxlBarGeometricDetLayers.begin(); - it2 != thePxlBarGeometricDetLayers.end(); - it2++) { - thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::PixelPhase1Barrel) { + auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) { + thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::PixelPhase2Barrel) { - vector thePxlBarGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = thePxlBarGeometricDetLayers.begin(); - it2 != thePxlBarGeometricDetLayers.end(); - it2++) { - thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::PixelPhase2Barrel) { + auto const &thePxlBarGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : thePxlBarGeometricDetLayers) { + thePxlBarLayers.push_back(aPixelBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::TIB) { - vector theTIBGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = theTIBGeometricDetLayers.begin(); - it2 != theTIBGeometricDetLayers.end(); - it2++) { - theTIBLayers.push_back(aTIBLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::TIB) { + auto const &theTIBGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : theTIBGeometricDetLayers) { + theTIBLayers.push_back(aTIBLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::TOB) { - vector theTOBGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = theTOBGeometricDetLayers.begin(); - it2 != theTOBGeometricDetLayers.end(); - it2++) { - theTOBLayers.push_back(aTOBLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::TOB) { + auto const &theTOBGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : theTOBGeometricDetLayers) { + theTOBLayers.push_back(aTOBLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::OTPhase2Barrel) { - vector theTOBGeometricDetLayers = (*it)->components(); - - for (vector::const_iterator it2 = theTOBGeometricDetLayers.begin(); - it2 != theTOBGeometricDetLayers.end(); - it2++) { - theTOBLayers.push_back(aPhase2OTBarrelLayerBuilder.build(*it2, theGeomDetGeometry, useBrothers)); + if (theGeomDetLayer->type() == GeometricDet::OTPhase2Barrel) { + auto const &theTOBGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : theTOBGeometricDetLayers) { + theTOBLayers.push_back(aPhase2OTBarrelLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers)); } } - if ((*it)->type() == GeometricDet::PixelEndCap) { - vector thePxlFwdGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = thePxlFwdGeometricDetLayers.begin(); - it2 != thePxlFwdGeometricDetLayers.end(); - it2++) { - if ((*it2)->positionBounds().z() < 0) - theNegPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(*it2, theGeomDetGeometry)); - if ((*it2)->positionBounds().z() > 0) - thePosPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::PixelEndCap) { + auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) { + if (thisGeomDet->positionBounds().z() < 0) + theNegPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); + else + thePosPxlFwdLayers.push_back(aPixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::PixelPhase1EndCap) { - vector thePxlFwdGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = thePxlFwdGeometricDetLayers.begin(); - it2 != thePxlFwdGeometricDetLayers.end(); - it2++) { - if ((*it2)->positionBounds().z() < 0) - theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry)); - if ((*it2)->positionBounds().z() > 0) - thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::PixelPhase1EndCap) { + auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) { + if (thisGeomDet->positionBounds().z() < 0) + theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); + else + thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::PixelPhase2EndCap) { - vector thePxlFwdGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = thePxlFwdGeometricDetLayers.begin(); - it2 != thePxlFwdGeometricDetLayers.end(); - it2++) { + if (theGeomDetLayer->type() == GeometricDet::PixelPhase2EndCap) { + auto const &thePxlFwdGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : thePxlFwdGeometricDetLayers) { //FIXME: this is just to keep the compatibility with the PixelPhase1 extension layout //hopefully we can get rid of it soon - if ((*it2)->positionBounds().z() < 0) { - if ((*it2)->type() == GeometricDet::PixelPhase2FullDisk || - (*it2)->type() == GeometricDet::PixelPhase2ReducedDisk) - theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry)); - else if ((*it2)->type() == GeometricDet::PixelPhase2TDRDisk) - theNegPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, false)); - } else if ((*it2)->positionBounds().z() > 0) { - if ((*it2)->type() == GeometricDet::PixelPhase2FullDisk || - (*it2)->type() == GeometricDet::PixelPhase2ReducedDisk) - thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(*it2, theGeomDetGeometry)); - else if ((*it2)->type() == GeometricDet::PixelPhase2TDRDisk) - thePosPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, false)); + if (thisGeomDet->positionBounds().z() < 0) { + if (thisGeomDet->type() == GeometricDet::PixelPhase2FullDisk || + thisGeomDet->type() == GeometricDet::PixelPhase2ReducedDisk) + theNegPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); + else if (thisGeomDet->type() == GeometricDet::PixelPhase2TDRDisk) + theNegPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, false)); + } else if (thisGeomDet->positionBounds().z() > 0) { + if (thisGeomDet->type() == GeometricDet::PixelPhase2FullDisk || + thisGeomDet->type() == GeometricDet::PixelPhase2ReducedDisk) + thePosPxlFwdLayers.push_back(aPhase1PixelForwardLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); + else if (thisGeomDet->type() == GeometricDet::PixelPhase2TDRDisk) + thePosPxlFwdLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, false)); } else { edm::LogError("TkDetLayers") << "In PixelPhase2EndCap the disks are neither PixelPhase2FullDisk nor " "PixelPhase2ReducedDisk nor PixelPhase2TDRDisk..."; @@ -153,41 +129,33 @@ GeometricSearchTracker* GeometricSearchTrackerBuilder::build(const GeometricDet* } } - if ((*it)->type() == GeometricDet::TID) { - vector theTIDGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = theTIDGeometricDetLayers.begin(); - it2 != theTIDGeometricDetLayers.end(); - it2++) { - if ((*it2)->positionBounds().z() < 0) - theNegTIDLayers.push_back(aTIDLayerBuilder.build(*it2, theGeomDetGeometry)); - if ((*it2)->positionBounds().z() > 0) - thePosTIDLayers.push_back(aTIDLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::TID) { + auto const &theTIDGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : theTIDGeometricDetLayers) { + if (thisGeomDet->positionBounds().z() < 0) + theNegTIDLayers.push_back(aTIDLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); + else + thePosTIDLayers.push_back(aTIDLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } - if ((*it)->type() == GeometricDet::OTPhase2EndCap) { - vector theTIDGeometricDetLayers = (*it)->components(); - - bool useBrothers = !usePhase2Stacks; - for (vector::const_iterator it2 = theTIDGeometricDetLayers.begin(); - it2 != theTIDGeometricDetLayers.end(); - it2++) { - if ((*it2)->positionBounds().z() < 0) - theNegTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, useBrothers)); - if ((*it2)->positionBounds().z() > 0) - thePosTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(*it2, theGeomDetGeometry, useBrothers)); + if (theGeomDetLayer->type() == GeometricDet::OTPhase2EndCap) { + auto const &theTIDGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : theTIDGeometricDetLayers) { + if (thisGeomDet->positionBounds().z() < 0) + theNegTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers)); + else + thePosTIDLayers.push_back(aPhase2EndcapLayerBuilder.build(thisGeomDet, theGeomDetGeometry, useBrothers)); } } - if ((*it)->type() == GeometricDet::TEC) { - vector theTECGeometricDetLayers = (*it)->components(); - for (vector::const_iterator it2 = theTECGeometricDetLayers.begin(); - it2 != theTECGeometricDetLayers.end(); - it2++) { - if ((*it2)->positionBounds().z() < 0) - theNegTECLayers.push_back(aTECLayerBuilder.build(*it2, theGeomDetGeometry)); - if ((*it2)->positionBounds().z() > 0) - thePosTECLayers.push_back(aTECLayerBuilder.build(*it2, theGeomDetGeometry)); + if (theGeomDetLayer->type() == GeometricDet::TEC) { + auto const &theTECGeometricDetLayers = theGeomDetLayer->components(); + for (auto const &thisGeomDet : theTECGeometricDetLayers) { + if (thisGeomDet->positionBounds().z() < 0) + theNegTECLayers.push_back(aTECLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); + else + thePosTECLayers.push_back(aTECLayerBuilder.build(thisGeomDet, theGeomDetGeometry)); } } } @@ -203,3 +171,42 @@ GeometricSearchTracker* GeometricSearchTrackerBuilder::build(const GeometricDet* thePosTECLayers, tTopo); } + +GeometricSearchTracker *GeometricSearchTrackerBuilder::build(const GeometricDet *theGeometricTracker, + const TrackerGeometry *theGeomDetGeometry, + const TrackerTopology *tTopo, + const MTDGeometry *mtd, + const MTDTopology *mTopo, + const bool usePhase2Stacks) { + //Tracker part + GeometricSearchTracker *theSearchTrack = this->build(theGeometricTracker, theGeomDetGeometry, tTopo, usePhase2Stacks); + + theSearchTrack->addDetLayerGeometry(); + theSearchTrack->mtdDetLayerGeometry->buildLayers(mtd, mTopo); + theSearchTrack->mtdDetLayerGeometry->sortLayers(); + + std::vector barrel; + for (auto &&e : theSearchTrack->mtdDetLayerGeometry->allBarrelLayers()) { + auto p = dynamic_cast(e); + if (p) { + barrel.push_back(p); + } + } + std::vector backward; + for (auto &&e : theSearchTrack->mtdDetLayerGeometry->allBackwardLayers()) { + auto p = dynamic_cast(e); + if (p) { + backward.push_back(p); + } + } + std::vector forward; + for (auto &&e : theSearchTrack->mtdDetLayerGeometry->allForwardLayers()) { + auto p = dynamic_cast(e); + if (p) { + forward.push_back(p); + } + } + //Include the MTD layers in the TrackerSearchGeometry + theSearchTrack->addMTDLayers(barrel, backward, forward); + return theSearchTrack; +} diff --git a/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.cc b/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.cc index 6824dab41fd31..c4f2dea02c8e6 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.cc +++ b/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.cc @@ -114,15 +114,13 @@ vector SimpleBarrelNavigableLayer::nextLayers(const FreeTraject bool signZmomentumXORdir = (((momentum.z() > 0) && !(dir == alongMomentum)) || (!(momentum.z() > 0) && (dir == alongMomentum))); - if - LIKELY(dirOppositeXORisInOutTrackBarrel && dirOppositeXORisInOutTrackFWD) { - if (signZmomentumXORdir) { - wellInside(ftsWithoutErrors, dir, theNegOuterLayers, result); - } else { - wellInside(ftsWithoutErrors, dir, thePosOuterLayers, result); - } + if LIKELY (dirOppositeXORisInOutTrackBarrel && dirOppositeXORisInOutTrackFWD) { + if (signZmomentumXORdir) { + wellInside(ftsWithoutErrors, dir, theNegOuterLayers, result); + } else { + wellInside(ftsWithoutErrors, dir, thePosOuterLayers, result); } - else if (!dirOppositeXORisInOutTrackBarrel && !dirOppositeXORisInOutTrackFWD) { + } else if (!dirOppositeXORisInOutTrackBarrel && !dirOppositeXORisInOutTrackFWD) { if (signZmomentumXORdir) { wellInside(ftsWithoutErrors, dir, thePosInnerLayers, result); } else { @@ -152,21 +150,20 @@ vector SimpleBarrelNavigableLayer::nextLayers(const FreeTraject LogDebug("SimpleBarrelNavigableLayer") << "goingIntoTheBarrel: " << goingIntoTheBarrel; - if - UNLIKELY(theSelfSearch && result.empty()) { - if (!goingIntoTheBarrel) { - LogDebug("SimpleBarrelNavigableLayer") - << " state is not going toward the center of the barrel. not adding self search."; - } else { - const BarrelDetLayer* bl = reinterpret_cast(detLayer()); - unsigned int before = result.size(); - LogDebug("SimpleBarrelNavigableLayer") << " I am trying to added myself as a next layer."; - wellInside(ftsWithoutErrors, dir, bl, result); - unsigned int after = result.size(); - if (before != after) - LogDebug("SimpleBarrelNavigableLayer") << " I have added myself as a next layer."; - } + if UNLIKELY (theSelfSearch && result.empty()) { + if (!goingIntoTheBarrel) { + LogDebug("SimpleBarrelNavigableLayer") + << " state is not going toward the center of the barrel. not adding self search."; + } else { + const BarrelDetLayer* bl = reinterpret_cast(detLayer()); + unsigned int before = result.size(); + LogDebug("SimpleBarrelNavigableLayer") << " I am trying to added myself as a next layer."; + wellInside(ftsWithoutErrors, dir, bl, result); + unsigned int after = result.size(); + if (before != after) + LogDebug("SimpleBarrelNavigableLayer") << " I have added myself as a next layer."; } + } return result; } diff --git a/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc b/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc index 1ff9051dfcd7b..6d80ce4572902 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc +++ b/RecoTracker/TkNavigation/plugins/SimpleNavigationSchool.cc @@ -82,9 +82,10 @@ void SimpleNavigationSchool::linkBarrelLayers(SymmetricLayerFinder& symFinder) { FDLC leftFL; FDLC rightFL; - // always add next barrel layer first - if (i + 1 != theBarrelLayers.end()) + //always add next barrel layer first + if (i + 1 != theBarrelLayers.end()) { reachableBL.push_back(*(i + 1)); + } // Add closest reachable forward layer (except for last BarrelLayer) if (i != theBarrelLayers.end() - 1) { diff --git a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc index af3f1ecde9258..fc7f1e8536475 100644 --- a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc +++ b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc @@ -37,6 +37,9 @@ #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include +#include + #include "TrackingTools/DetLayers/interface/NavigationSchool.h" #include "RecoTracker/Record/interface/NavigationSchoolRecord.h" @@ -75,6 +78,12 @@ void NavigationSchoolAnalyzer::print(std::ostream& os, const DetLayer* dl) { if (GeomDetEnumerators::isTracker(dl->subDetector())) { LorW = tTopo->layer(tag->geographicalId()); side = tTopo->side(tag->geographicalId()); + } else if (dl->subDetector() == GeomDetEnumerators::TimingEndcap) { + ETLDetId id(dl->basicComponents().front()->geographicalId().rawId()); + LorW = id.nDisc(); + //The MTD side returns 0 for the negative side and 1 for the positive side + //In order to be comp + side = id.mtdSide() + 1; } else { switch (dl->subDetector()) { case GeomDetEnumerators::DT: diff --git a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_cfg.py b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_cfg.py index dd7c78377a1ed..89b73e37f9efc 100644 --- a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_cfg.py +++ b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer_cfg.py @@ -6,8 +6,7 @@ # process.load("Configuration.StandardSequences.Geometry_cff") #process.load('Configuration.StandardSequences.GeometryRecoDB_cff') -#process.load('Configuration.Geometry.GeometryExtended2023D1Reco_cff') -process.load('Configuration.Geometry.GeometryExtended2023D4Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff') process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') from Configuration.AlCa.GlobalTag import GlobalTag @@ -23,6 +22,13 @@ # indentation = cms.untracked.string('$$') #) + +#This has to be modified in order to read the tracker + MTD structure +process.TrackerRecoGeometryESProducer = cms.ESProducer("TrackerMTDRecoGeometryESProducer", + usePhase2Stacks = cms.bool(False) +) + + process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) diff --git a/RecoTracker/TkSeedGenerator/plugins/BuildFile.xml b/RecoTracker/TkSeedGenerator/plugins/BuildFile.xml index 65c849c69bbdf..642ab8c32202e 100644 --- a/RecoTracker/TkSeedGenerator/plugins/BuildFile.xml +++ b/RecoTracker/TkSeedGenerator/plugins/BuildFile.xml @@ -22,7 +22,6 @@ - diff --git a/RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h b/RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h index ce45577aca261..cf1d95d009a8b 100644 --- a/RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h +++ b/RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h @@ -189,7 +189,8 @@ class DAClusterizerInZ_vect final : public TrackClusterizerInZ { double update( double beta, track_t >racks, vertex_t &gvertices, const double rho0 = 0, const bool updateTc = false) const; - void dump(const double beta, const vertex_t &y, const track_t &tks, const int verbosity = 0) const; + void dump( + const double beta, const vertex_t &y, const track_t &tks, const int verbosity = 0, const double rho0 = 0.) const; bool merge(vertex_t &y, track_t &tks, double &beta) const; bool purge(vertex_t &, track_t &, double &, const double) const; bool split(const double beta, track_t &t, vertex_t &y, double threshold = 1.) const; diff --git a/RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZ_vect.cc b/RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZ_vect.cc index f9312dcebc26a..6742f54d2d20b 100644 --- a/RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZ_vect.cc +++ b/RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZ_vect.cc @@ -452,7 +452,7 @@ unsigned int DAClusterizerInZ_vect::thermalize( std::cout << "DAClusterizerInZ_vect.thermalize niter = " << niter << " at T = " << 1 / beta << " nv = " << v.getSize() << std::endl; if (DEBUGLEVEL > 2) - dump(beta, v, tks, 0); + dump(beta, v, tks, 0, rho0); } #endif @@ -483,31 +483,26 @@ bool DAClusterizerInZ_vect::merge(vertex_t& y, track_t& tks, double& beta) const for (unsigned int ik = 0; ik < critical.size(); ik++) { unsigned int k = critical[ik].second; double rho = y.rho[k] + y.rho[k + 1]; - double swE = y.swE[k] + y.swE[k + 1] - y.rho[k] * y.rho[k + 1] / rho * std::pow(y.zvtx[k + 1] - y.zvtx[k], 2); - double Tc = 2 * swE / (y.sw[k] + y.sw[k + 1]); - if (Tc * beta < 1) { #ifdef DEBUG - assert((k + 1) < nv); - if (DEBUGLEVEL > 1) { - std::cout << "merging " << fixed << setprecision(4) << y.zvtx[k + 1] << " and " << y.zvtx[k] << " Tc = " << Tc - << " sw = " << y.sw[k] + y.sw[k + 1] << std::endl; - } + assert((k + 1) < nv); + if (DEBUGLEVEL > 1) { + std::cout << "merging " << fixed << setprecision(4) << y.zvtx[k + 1] << " and " << y.zvtx[k] + << " sw = " << y.sw[k] + y.sw[k + 1] << std::endl; + } #endif - if (rho > 0) { - y.zvtx[k] = (y.rho[k] * y.zvtx[k] + y.rho[k + 1] * y.zvtx[k + 1]) / rho; - } else { - y.zvtx[k] = 0.5 * (y.zvtx[k] + y.zvtx[k + 1]); - } - y.rho[k] = rho; - y.sw[k] += y.sw[k + 1]; - y.swE[k] = swE; - y.removeItem(k + 1, tks); - set_vtx_range(beta, tks, y); - y.extractRaw(); - return true; + if (rho > 0) { + y.zvtx[k] = (y.rho[k] * y.zvtx[k] + y.rho[k + 1] * y.zvtx[k + 1]) / rho; + } else { + y.zvtx[k] = 0.5 * (y.zvtx[k] + y.zvtx[k + 1]); } + y.rho[k] = rho; + y.sw[k] += y.sw[k + 1]; + y.removeItem(k + 1, tks); + set_vtx_range(beta, tks, y); + y.extractRaw(); + return true; } return false; @@ -645,9 +640,11 @@ double DAClusterizerInZ_vect::beta0(double betamax, track_t const& tks, vertex_t bool DAClusterizerInZ_vect::split(const double beta, track_t& tks, vertex_t& y, double threshold) const { // split only critical vertices (Tc >~ T=1/beta <==> beta*Tc>~1) - // an update must have been made just before doing this (same beta, no merging) // returns true if at least one cluster was split + // update the sums needed for Tc, rho0 is never non-zero while splitting is still active + update(beta, tks, y, 0., true); // the "true" flag enables Tc evaluation + constexpr double epsilon = 1e-3; // minimum split size unsigned int nv = y.getSize(); @@ -794,9 +791,8 @@ vector DAClusterizerInZ_vect::vertices(const vector DAClusterizerInZ_vect::vertices(const vector DAClusterizerInZ_vect::vertices(const vector 0) { - rho0 = 1. / nt; + rho0 = y.getSize() > 1 ? 1. / y.getSize() : 1.; for (unsigned int a = 0; a < 5; a++) { update(beta, tks, y, a * rho0 / 5.); // adiabatic turn-on } } thermalize(beta, tks, y, delta_lowT_, rho0); - update(beta, tks, y, rho0, true); #ifdef DEBUG verify(y, tks); @@ -860,13 +854,13 @@ vector DAClusterizerInZ_vect::vertices(const vector @@ -7,7 +6,6 @@ - diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixAmplitudeFilter.h similarity index 73% rename from SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h rename to SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixAmplitudeFilter.h index efc512659f0ba..4ae45a6bc5951 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixAmplitudeFilter.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_AMPLITUDE_FILTER_H -#define ECAL_FENIX_AMPLITUDE_FILTER_H +#ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixAmplitudeFilter_h +#define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixAmplitudeFilter_h #include #include @@ -8,13 +8,13 @@ class EcalTPGWeightIdMap; class EcalTPGWeightGroup; /** - \ class EcalFenixAmplitudeFilter + \ class EcalEBFenixAmplitudeFilter \brief calculates .... for Fenix strip, barrel * input: 18 bits * output: 18 bits * */ -class EcalFenixAmplitudeFilter { +class EcalEBFenixAmplitudeFilter { private: int peakFlag_[5]; int inputsAlreadyIn_; @@ -29,8 +29,8 @@ class EcalFenixAmplitudeFilter { int processedFgvbOutput_; public: - EcalFenixAmplitudeFilter(); - virtual ~EcalFenixAmplitudeFilter(); + EcalEBFenixAmplitudeFilter(); + virtual ~EcalEBFenixAmplitudeFilter(); virtual void process(std::vector &addout, std::vector &output, std::vector &fgvbIn, diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixLinearizer.h b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixLinearizer.h similarity index 69% rename from SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixLinearizer.h rename to SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixLinearizer.h index dd3d9a73b22de..368347aec0775 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixLinearizer.h +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixLinearizer.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_LINEARIZER_H -#define ECAL_FENIX_LINEARIZER_H +#ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixLinearizer_h +#define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixLinearizer_h #include #include @@ -9,14 +9,14 @@ #include /** - \class EcalFenixLinearizer + \class EcalEBFenixLinearizer \brief Linearisation for Fenix strip * input: 16 bits corresponding to input EBDataFrame * output: 18 bits * */ -class EcalFenixLinearizer { +class EcalEBFenixLinearizer { private: bool famos_; int uncorrectedSample_; @@ -37,8 +37,8 @@ class EcalFenixLinearizer { int process(); public: - EcalFenixLinearizer(bool famos); - virtual ~EcalFenixLinearizer(); + EcalEBFenixLinearizer(bool famos); + virtual ~EcalEBFenixLinearizer(); template void process(const T &, std::vector &); @@ -49,7 +49,7 @@ class EcalFenixLinearizer { }; template -void EcalFenixLinearizer::process(const T &df, std::vector &output_percry) { +void EcalEBFenixLinearizer::process(const T &df, std::vector &output_percry) { //We know a tower numbering is: // S1 S2 S3 S4 S5 // @@ -59,21 +59,11 @@ void EcalFenixLinearizer::process(const T &df, std::vector &output_percry) // 1 8 11 18 21 // 0 9 10 19 20 - //std::cout << " EcalFenixLinearizer::process(const .. DataFrame " << std::endl; - for (int i = 0; i < df.size(); i++) { - //std::cout << df[i] << " "; - } - for (int i = 0; i < df.size(); i++) { setInput(df[i]); output_percry[i] = process(); } - //std::cout << " EcalFenixLinearizer::process(const .. Final output " << std::endl; - for (int i = 0; i < df.size(); i++) { - //std::cout << " output_percry " << output_percry[i]<< " "; - } - return; } diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixPeakFinder.h b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixPeakFinder.h similarity index 72% rename from SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixPeakFinder.h rename to SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixPeakFinder.h index 93c1c42662a6b..f39426c8b777e 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixPeakFinder.h +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixPeakFinder.h @@ -1,10 +1,10 @@ -#ifndef ECAL_FENIX_PEAKFINDER_H -#define ECAL_FENIX_PEAKFINDER_H +#ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixPeakFinder_h +#define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixPeakFinder_h #include /** - \ class EcalFenixPeakFinder + \ class EcalEBFenixPeakFinder \brief calculates the peak for Fenix strip, barrel * input : 18 bits * output: boolean @@ -13,7 +13,7 @@ * ----> do we really need caloVShape? */ -class EcalFenixPeakFinder { +class EcalEBFenixPeakFinder { private: bool disabled; int setInput(int input); @@ -23,8 +23,8 @@ class EcalFenixPeakFinder { int buffer_[3]; public: - EcalFenixPeakFinder(); - virtual ~EcalFenixPeakFinder(); + EcalEBFenixPeakFinder(); + virtual ~EcalEBFenixPeakFinder(); virtual std::vector process(std::vector& filtout, std::vector& output); // from CaloVShape // virtual double operator()(double) const {return 0.;} diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixStripFormatEB.h b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixStripFormatEB.h similarity index 70% rename from SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixStripFormatEB.h rename to SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixStripFormatEB.h index bbd6d886cead5..b379c556dd041 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixStripFormatEB.h +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixStripFormatEB.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_STRIP_FORMAT_EB_H -#define ECAL_FENIX_STRIP_FORMAT_EB_H +#ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixStripFormatEB_h +#define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixStripFormatEB_h #include #include @@ -7,7 +7,7 @@ class EcalTPGSlidingWindow; /** - \class EcalFenixStripFormatEB + \class EcalEBFenixStripFormatEB \brief Formatting for Fenix strip * input: 18 bits + 3x 1bit (fgvb, gapflagbit, output from peakfinder) * output:16 bits @@ -15,7 +15,7 @@ class EcalTPGSlidingWindow; * --- not really a calodataframe no? */ -class EcalFenixStripFormatEB { +class EcalEBFenixStripFormatEB { private: int inputsFGVB_; int inputPeak_; @@ -27,8 +27,8 @@ class EcalFenixStripFormatEB { int process(); public: - EcalFenixStripFormatEB(); - virtual ~EcalFenixStripFormatEB(); + EcalEBFenixStripFormatEB(); + virtual ~EcalEBFenixStripFormatEB(); virtual void process(std::vector &, std::vector &, std::vector &, std::vector &); void setParameters(uint32_t &, const EcalTPGSlidingWindow *&); }; diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixTcpFormat.h b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixTcpFormat.h similarity index 80% rename from SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixTcpFormat.h rename to SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixTcpFormat.h index e4f84312ea4ec..b61a19a4b40c3 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalFenixTcpFormat.h +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixTcpFormat.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_TCP_FORMAT_H -#define ECAL_FENIX_TCP_FORMAT_H +#ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixTcpFormat_h +#define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixTcpFormat_h #include "DataFormats/EcalDigi/interface/EcalEBTriggerPrimitiveSample.h" #include @@ -10,7 +10,7 @@ class EcalTPGTowerStatus; class EcalTPGSpike; /** - \class EcalFenixStripFormat + \class EcalEBFenixTcpFormat \brief Formatting for Fenix Tcp * input 10 bits from Ettot * 1 bit from fgvb @@ -19,10 +19,10 @@ class EcalTPGSpike; * simple formatting * */ -class EcalFenixTcpFormat { +class EcalEBFenixTcpFormat { public: - EcalFenixTcpFormat(bool tccFormat, bool debug, bool famos, int binOfMax); - virtual ~EcalFenixTcpFormat(); + EcalEBFenixTcpFormat(bool tccFormat, bool debug, bool famos, int binOfMax); + virtual ~EcalEBFenixTcpFormat(); void process(std::vector &, std::vector &); void process(std::vector &Et, diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBTrigPrimTestAlgo.h b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBTrigPrimTestAlgo.h index 590ec84824998..a56af8869ff3f 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBTrigPrimTestAlgo.h +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBTrigPrimTestAlgo.h @@ -1,5 +1,5 @@ -#ifndef EcalEBTrigPrimTestAlgo_h -#define EcalEBTrigPrimTestAlgo_h +#ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBTrigPrimTestAlgo_h +#define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBTrigPrimTestAlgo_h /** \class EcalEBTrigPrimTestAlgo \author N. Marinelli - Univ. of Notre Dame * forPhase II @@ -14,22 +14,17 @@ #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h" #include "DataFormats/Common/interface/SortedCollection.h" -//#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -37,21 +32,24 @@ class EcalTrigTowerDetId; class ETPCoherenceTest; class EcalEBTriggerPrimitiveSample; -class CaloSubdetectorGeometry; class EBDataFrame; class EcalEBTrigPrimTestAlgo { public: - explicit EcalEBTrigPrimTestAlgo( - const edm::EventSetup &setup, int nSamples, int binofmax, bool tcpFormat, bool barrelOnly, bool debug, bool famos); + // not BarrelOnly + explicit EcalEBTrigPrimTestAlgo(const EcalTrigTowerConstituentsMap *eTTmap, + const CaloGeometry *theGeometry, + int nSamples, + int binofmax, + bool tcpFormat, + bool debug, + bool famos); + //barrel only + explicit EcalEBTrigPrimTestAlgo(int nSamples, int binofmax, bool tcpFormat, bool debug, bool famos); virtual ~EcalEBTrigPrimTestAlgo(); - // void run(const edm::EventSetup &, const EcalRecHitCollection *col, EcalEBTrigPrimDigiCollection & result, EcalEBTrigPrimDigiCollection & resultTcp); - void run(const edm::EventSetup &, - const EBDigiCollection *col, - EcalEBTrigPrimDigiCollection &result, - EcalEBTrigPrimDigiCollection &resultTcp); + void run(const EBDigiCollection *col, EcalEBTrigPrimDigiCollection &result, EcalEBTrigPrimDigiCollection &resultTcp); void setPointers(const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGPedestals *ecaltpPed, @@ -76,7 +74,7 @@ class EcalEBTrigPrimTestAlgo { } private: - void init(const edm::EventSetup &); + void init(); template void initStructures(std::vector > > > &towMap); template @@ -97,9 +95,8 @@ class EcalEBTrigPrimTestAlgo { return ind; } - edm::ESHandle eTTmap_; - // const CaloSubdetectorGeometry *theEndcapGeometry; - edm::ESHandle theGeometry; + const EcalTrigTowerConstituentsMap *eTTmap_ = nullptr; + const CaloGeometry *theGeometry_ = nullptr; float threshold; int nSamples_; @@ -129,11 +126,11 @@ class EcalEBTrigPrimTestAlgo { const EcalElectronicsMapping *theMapping_; - std::vector linearizer_; - EcalFenixAmplitudeFilter *amplitude_filter_; - EcalFenixPeakFinder *peak_finder_; - EcalFenixStripFormatEB *fenixFormatterEB_; - EcalFenixTcpFormat *fenixTcpFormat_; + std::vector linearizer_; + EcalEBFenixAmplitudeFilter *amplitude_filter_; + EcalEBFenixPeakFinder *peak_finder_; + EcalEBFenixStripFormatEB *fenixFormatterEB_; + EcalEBFenixTcpFormat *fenixTcpFormat_; // const EcalTPGPedestals *ecaltpPed_; @@ -147,10 +144,10 @@ class EcalEBTrigPrimTestAlgo { const EcalTPGTowerStatus *ecaltpgBadTT_; const EcalTPGSpike *ecaltpgSpike_; - EcalFenixLinearizer *getLinearizer(int i) const { return linearizer_[i]; } + EcalEBFenixLinearizer *getLinearizer(int i) const { return linearizer_[i]; } std::vector > lin_out_; // - EcalFenixAmplitudeFilter *getFilter() const { return amplitude_filter_; } + EcalEBFenixAmplitudeFilter *getFilter() const { return amplitude_filter_; } std::vector filt_out_; std::vector peak_out_; std::vector format_out_; @@ -159,10 +156,10 @@ class EcalEBTrigPrimTestAlgo { std::vector fgvb_out_temp_; // - EcalFenixPeakFinder *getPeakFinder() const { return peak_finder_; } - EcalFenixStripFormatEB *getFormatterEB() const { return fenixFormatterEB_; } + EcalEBFenixPeakFinder *getPeakFinder() const { return peak_finder_; } + EcalEBFenixStripFormatEB *getFormatterEB() const { return fenixFormatterEB_; } // - EcalFenixTcpFormat *getFormatter() const { return fenixTcpFormat_; } + EcalEBFenixTcpFormat *getFormatter() const { return fenixTcpFormat_; } std::vector tcpformat_out_; }; diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixAmplitudeFilter.cc similarity index 72% rename from SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc rename to SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixAmplitudeFilter.cc index aa74beae06a7e..ce4224d12db9f 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixAmplitudeFilter.cc @@ -1,28 +1,28 @@ -#include +#include #include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" #include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" #include "CondFormats/EcalObjects/interface/EcalTPGGroups.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include -EcalFenixAmplitudeFilter::EcalFenixAmplitudeFilter() : inputsAlreadyIn_(0), shift_(6) {} +EcalEBFenixAmplitudeFilter::EcalEBFenixAmplitudeFilter() : inputsAlreadyIn_(0), shift_(6) {} -EcalFenixAmplitudeFilter::~EcalFenixAmplitudeFilter() {} +EcalEBFenixAmplitudeFilter::~EcalEBFenixAmplitudeFilter() {} -int EcalFenixAmplitudeFilter::setInput(int input, int fgvb) { +int EcalEBFenixAmplitudeFilter::setInput(int input, int fgvb) { if (input > 0X3FFFF) { std::cout << "ERROR IN INPUT OF AMPLITUDE FILTER" << std::endl; return -1; } if (inputsAlreadyIn_ < 5) { - //std::cout << " EcalFenixAmplitudeFilter::setInput inputsAlreadyIn_<5 input " << input << std::endl; + //std::cout << " EcalEBFenixAmplitudeFilter::setInput inputsAlreadyIn_<5 input " << input << std::endl; buffer_[inputsAlreadyIn_] = input; fgvbBuffer_[inputsAlreadyIn_] = fgvb; inputsAlreadyIn_++; } else { for (int i = 0; i < 4; i++) { buffer_[i] = buffer_[i + 1]; - //std::cout << " EcalFenixAmplitudeFilter::setInput inputsAlreadyIn buffer " << buffer_[i] << std::endl; + //std::cout << " EcalEBFenixAmplitudeFilter::setInput inputsAlreadyIn buffer " << buffer_[i] << std::endl; fgvbBuffer_[i] = fgvbBuffer_[i + 1]; } buffer_[4] = input; @@ -31,10 +31,10 @@ int EcalFenixAmplitudeFilter::setInput(int input, int fgvb) { return 1; } -void EcalFenixAmplitudeFilter::process(std::vector &addout, - std::vector &output, - std::vector &fgvbIn, - std::vector &fgvbOut) { +void EcalEBFenixAmplitudeFilter::process(std::vector &addout, + std::vector &output, + std::vector &fgvbIn, + std::vector &fgvbOut) { // test inputsAlreadyIn_ = 0; @@ -45,7 +45,7 @@ void EcalFenixAmplitudeFilter::process(std::vector &addout, // test end - //std::cout << " EcalFenixAmplitudeFilter::process(std::vector &addout size " << addout.size() << std::endl; + //std::cout << " EcalEBFenixAmplitudeFilter::process(std::vector &addout size " << addout.size() << std::endl; for (unsigned int i = 0; i < addout.size(); i++) { setInput(addout[i], fgvbIn[i]); for (unsigned int i = 0; i < 5; i++) { @@ -69,7 +69,7 @@ void EcalFenixAmplitudeFilter::process(std::vector &addout, return; } -void EcalFenixAmplitudeFilter::process() { +void EcalEBFenixAmplitudeFilter::process() { //UB FIXME: 5 processedOutput_ = 0; processedFgvbOutput_ = 0; @@ -92,9 +92,9 @@ void EcalFenixAmplitudeFilter::process() { processedFgvbOutput_ = fgvbInt; } -void EcalFenixAmplitudeFilter::setParameters(uint32_t raw, - const EcalTPGWeightIdMap *ecaltpgWeightMap, - const EcalTPGWeightGroup *ecaltpgWeightGroup) { +void EcalEBFenixAmplitudeFilter::setParameters(uint32_t raw, + const EcalTPGWeightIdMap *ecaltpgWeightMap, + const EcalTPGWeightGroup *ecaltpgWeightGroup) { uint32_t params_[5]; const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgWeightGroup->getMap(); EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(raw); diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixLinearizer.cc b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixLinearizer.cc similarity index 74% rename from SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixLinearizer.cc rename to SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixLinearizer.cc index 2f232249fa773..b6ee95d4637c2 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixLinearizer.cc +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixLinearizer.cc @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -6,10 +6,10 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -EcalFenixLinearizer::EcalFenixLinearizer(bool famos) +EcalEBFenixLinearizer::EcalEBFenixLinearizer(bool famos) : famos_(famos), init_(false), linConsts_(nullptr), peds_(nullptr), badXStatus_(nullptr) {} -EcalFenixLinearizer::~EcalFenixLinearizer() { +EcalEBFenixLinearizer::~EcalEBFenixLinearizer() { if (init_) { for (int i = 0; i < (int)vectorbadXStatus_.size(); i++) { delete vectorbadXStatus_[i]; @@ -17,10 +17,10 @@ EcalFenixLinearizer::~EcalFenixLinearizer() { } } -void EcalFenixLinearizer::setParameters(uint32_t raw, - const EcalTPGPedestals *ecaltpPed, - const EcalTPGLinearizationConst *ecaltpLin, - const EcalTPGCrystalStatus *ecaltpBadX) { +void EcalEBFenixLinearizer::setParameters(uint32_t raw, + const EcalTPGPedestals *ecaltpPed, + const EcalTPGLinearizationConst *ecaltpLin, + const EcalTPGCrystalStatus *ecaltpBadX) { const EcalTPGLinearizationConstMap &linMap = ecaltpLin->getMap(); EcalTPGLinearizationConstMapIterator it = linMap.find(raw); @@ -48,24 +48,24 @@ void EcalFenixLinearizer::setParameters(uint32_t raw, } } -int EcalFenixLinearizer::process() { +int EcalEBFenixLinearizer::process() { int output = (uncorrectedSample_ - base_); //Substract base - //std::cout << " EcalFenixLinearizer::process() output non bit shifted " << output << std::endl; + //std::cout << " EcalEBFenixLinearizer::process() output non bit shifted " << output << std::endl; if (famos_ || output < 0) return 0; if (output < 0) return shift_ << 12; // FENIX bug(!) output = (output * mult_) >> (shift_ + 2); //Apply multiplicative factor - //std::cout << " EcalFenixLinearizer::process() output 2nd step " << output << std::endl; + //std::cout << " EcalEBFenixLinearizer::process() output 2nd step " << output << std::endl; if (output > 0X3FFFF) output = 0X3FFFF; //Saturation if too high - //std::cout << " EcalFenixLinearizer::process() output 3rd step " << output << std::endl; + //std::cout << " EcalEBFenixLinearizer::process() output 3rd step " << output << std::endl; return output; } -int EcalFenixLinearizer::setInput(const EcalMGPASample &RawSam) { - //std::cout << " EcalFenixLinearizer::setInput RawSam.raw() " << RawSam.raw() << std::endl; +int EcalEBFenixLinearizer::setInput(const EcalMGPASample &RawSam) { + //std::cout << " EcalEBFenixLinearizer::setInput RawSam.raw() " << RawSam.raw() << std::endl; if (RawSam.raw() > 0X3FFF) { LogDebug("EcalTPG") << "ERROR IN INPUT SAMPLE OF FENIX LINEARIZER"; return -1; @@ -118,7 +118,7 @@ int EcalFenixLinearizer::setInput(const EcalMGPASample &RawSam) { } } - //std::cout << " EcalFenixLinearizer::setInput uncorrectedSample_ " << RawSam.adc() << " gainID " << gainID_ << " baseline " << base_ << std::endl; + //std::cout << " EcalEBFenixLinearizer::setInput uncorrectedSample_ " << RawSam.adc() << " gainID " << gainID_ << " baseline " << base_ << std::endl; if (famos_) base_ = 200; //FIXME by preparing a correct TPG.txt for Famos diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixPeakFinder.cc b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixPeakFinder.cc similarity index 59% rename from SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixPeakFinder.cc rename to SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixPeakFinder.cc index fc40883c351bb..e8c17b88c0905 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixPeakFinder.cc +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixPeakFinder.cc @@ -1,26 +1,26 @@ -#include +#include #include -EcalFenixPeakFinder::EcalFenixPeakFinder() : inputsAlreadyIn_(0) {} +EcalEBFenixPeakFinder::EcalEBFenixPeakFinder() : inputsAlreadyIn_(0) {} -EcalFenixPeakFinder::~EcalFenixPeakFinder() {} +EcalEBFenixPeakFinder::~EcalEBFenixPeakFinder() {} -int EcalFenixPeakFinder::setInput(int input) { +int EcalEBFenixPeakFinder::setInput(int input) { if (inputsAlreadyIn_ < 3) { - //std::cout << " EcalFenixPeakFinder::setInput inputsAlreadyIn_<3 input " << input << std::endl; + //std::cout << " EcalEBFenixPeakFinder::setInput inputsAlreadyIn_<3 input " << input << std::endl; buffer_[inputsAlreadyIn_] = input; inputsAlreadyIn_++; } else { for (int i = 0; i < 2; i++) { buffer_[i] = buffer_[i + 1]; - //std::cout << " EcalFenixPeakFinder::setInput inputsAlreadyIn buffer " << buffer_[i] << std::endl; + //std::cout << " EcalEBFenixPeakFinder::setInput inputsAlreadyIn buffer " << buffer_[i] << std::endl; } buffer_[2] = input; } return 1; } -int EcalFenixPeakFinder::process() { +int EcalEBFenixPeakFinder::process() { if (inputsAlreadyIn_ < 3) return 0; if (buffer_[1] > buffer_[0] && buffer_[1] > buffer_[2]) @@ -29,7 +29,7 @@ int EcalFenixPeakFinder::process() { return 0; } -std::vector EcalFenixPeakFinder::process(std::vector &filtout, std::vector &output) { +std::vector EcalEBFenixPeakFinder::process(std::vector &filtout, std::vector &output) { // FIXME: 3 inputsAlreadyIn_ = 0; for (unsigned int i = 0; i < 3; i++) @@ -37,7 +37,7 @@ std::vector EcalFenixPeakFinder::process(std::vector &filtout, std::ve // std::vector output; - //std::cout << " EcalFenixPeakFinder::process( " << filtout.size() << std::endl; + //std::cout << " EcalEBFenixPeakFinder::process( " << filtout.size() << std::endl; // attention, we have to shift by one, because the peak is found one too late for (unsigned int i = 0; i < filtout.size(); i++) { setInput(filtout[i]); diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixStripFormatEB.cc b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixStripFormatEB.cc similarity index 50% rename from SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixStripFormatEB.cc rename to SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixStripFormatEB.cc index c8548fae9bd97..316b889e890d0 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixStripFormatEB.cc +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixStripFormatEB.cc @@ -1,44 +1,44 @@ -#include +#include #include #include "FWCore/MessageLogger/interface/MessageLogger.h" -EcalFenixStripFormatEB::EcalFenixStripFormatEB() : shift_(0) {} +EcalEBFenixStripFormatEB::EcalEBFenixStripFormatEB() : shift_(0) {} -EcalFenixStripFormatEB::~EcalFenixStripFormatEB() {} +EcalEBFenixStripFormatEB::~EcalEBFenixStripFormatEB() {} -int EcalFenixStripFormatEB::setInput(int input, int inputPeak, int inputsFGVB) { +int EcalEBFenixStripFormatEB::setInput(int input, int inputPeak, int inputsFGVB) { inputsFGVB_ = inputsFGVB; inputPeak_ = inputPeak; input_ = input; return 0; } -int EcalFenixStripFormatEB::process() { +int EcalEBFenixStripFormatEB::process() { // buffer_=input_>>shift_; //FIXME: buffer why? if (inputPeak_ == 0) return ((inputsFGVB_ & 0x1) << 12); // int output=buffer_; int output = input_ >> shift_; - //std::cout << " EcalFenixStripFormatEB::process() input_ " << input_ << " output after shift " << output << std::endl; + //std::cout << " EcalEBFenixStripFormatEB::process() input_ " << input_ << " output after shift " << output << std::endl; if (output > 0XFFF) output = 0XFFF; //ok: barrel saturates at 12 bits // Add stripFGVB output |= ((inputsFGVB_ & 0x1) << 12); - //std::cout << " EcalFenixStripFormatEB::process() output after adding FGVB " << output << std::endl; + //std::cout << " EcalEBFenixStripFormatEB::process() output after adding FGVB " << output << std::endl; return output; } -void EcalFenixStripFormatEB::process(std::vector &sFGVBout, - std::vector &peakout, - std::vector &filtout, - std::vector &output) { +void EcalEBFenixStripFormatEB::process(std::vector &sFGVBout, + std::vector &peakout, + std::vector &filtout, + std::vector &output) { if (peakout.size() != filtout.size() || sFGVBout.size() != filtout.size()) { edm::LogWarning("EcalTPG") - << " problem in EcalFenixStripFormatEB: sfgvb_out, peak_out and filt_out don't have the same size"; + << " problem in EcalEBFenixStripFormatEB: sfgvb_out, peak_out and filt_out don't have the same size"; } - //std::cout << " EcalFenixStripFormatEB::process(std::vector ... filtout size " << filtout.size() << std::endl; + //std::cout << " EcalEBFenixStripFormatEB::process(std::vector ... filtout size " << filtout.size() << std::endl; for (unsigned int i = 0; i < filtout.size(); i++) { //std::cout << " Looping over filtout " << filtout[i] << " " << peakout[i] << std::endl; setInput(filtout[i], peakout[i], sFGVBout[i]); @@ -48,7 +48,7 @@ void EcalFenixStripFormatEB::process(std::vector &sFGVBout, return; } -void EcalFenixStripFormatEB::setParameters(uint32_t &id, const EcalTPGSlidingWindow *&slWin) { +void EcalEBFenixStripFormatEB::setParameters(uint32_t &id, const EcalTPGSlidingWindow *&slWin) { const EcalTPGSlidingWindowMap &slwinmap = slWin->getMap(); EcalTPGSlidingWindowMapIterator it = slwinmap.find(id); if (it != slwinmap.end()) diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixTcpFormat.cc b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixTcpFormat.cc similarity index 76% rename from SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixTcpFormat.cc rename to SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixTcpFormat.cc index f5fd039bd365d..6bf0a35922054 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalFenixTcpFormat.cc +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBFenixTcpFormat.cc @@ -1,4 +1,4 @@ -#include +#include #include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" #include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" @@ -8,19 +8,19 @@ using namespace std; -EcalFenixTcpFormat::EcalFenixTcpFormat(bool tcpFormat, bool debug, bool famos, int binOfMax) +EcalEBFenixTcpFormat::EcalEBFenixTcpFormat(bool tcpFormat, bool debug, bool famos, int binOfMax) : tcpFormat_(tcpFormat), debug_(debug), famos_(famos), binOfMax_(binOfMax) { status_ = 0; badTTStatus_ = &status_; } -EcalFenixTcpFormat::~EcalFenixTcpFormat() {} +EcalEBFenixTcpFormat::~EcalEBFenixTcpFormat() {} -void EcalFenixTcpFormat::process(std::vector &Etin, std::vector &Etout) { +void EcalEBFenixTcpFormat::process(std::vector &Etin, std::vector &Etout) { // put TP-s in the output // on request also in TcpFormat // for famos version we have to write dummies except for the middle - // std::cout << " EcalFenixTcpFormat::process(... Etout size " << Etout.size() << " Et size " << Etin.size() << std::endl; + // std::cout << " EcalEBFenixTcpFormat::process(... Etout size " << Etout.size() << " Et size " << Etin.size() << std::endl; int myEt; int eTTotShift = 2; @@ -46,17 +46,17 @@ void EcalFenixTcpFormat::process(std::vector &Etin, std::vector &Etout } } -void EcalFenixTcpFormat::process(std::vector &Et, - std::vector &fgvb, - std::vector &sfgvb, - int eTTotShift, - std::vector &out, - std::vector &out2, - bool isInInnerRings) { +void EcalEBFenixTcpFormat::process(std::vector &Et, + std::vector &fgvb, + std::vector &sfgvb, + int eTTotShift, + std::vector &out, + std::vector &out2, + bool isInInnerRings) { // put TP-s in the output // on request also in TcpFormat // for famos version we have to write dummies except for the middle - //std::cout << " EcalFenixTcpFormat::process(... out size " << out.size() << " Et size " << Et.size() << " Et[0] " << Et[0] << std::endl; + //std::cout << " EcalEBFenixTcpFormat::process(... out size " << out.size() << " Et size " << Et.size() << " Et[0] " << Et[0] << std::endl; int myEt; if (famos_) { @@ -128,11 +128,11 @@ void EcalFenixTcpFormat::process(std::vector &Et, } } -void EcalFenixTcpFormat::setParameters(uint32_t towid, - const EcalTPGLutGroup *ecaltpgLutGroup, - const EcalTPGLutIdMap *ecaltpgLut, - const EcalTPGTowerStatus *ecaltpgbadTT, - const EcalTPGSpike *ecaltpgSpike) { +void EcalEBFenixTcpFormat::setParameters(uint32_t towid, + const EcalTPGLutGroup *ecaltpgLutGroup, + const EcalTPGLutIdMap *ecaltpgLut, + const EcalTPGTowerStatus *ecaltpgbadTT, + const EcalTPGSpike *ecaltpgSpike) { // Get TP zeroing threshold - defaut to 1023 for old data (no record found or EE) spikeZeroThresh_ = 1023; if (ecaltpgSpike != nullptr) { diff --git a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBTrigPrimTestAlgo.cc b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBTrigPrimTestAlgo.cc index 5387566789389..48dfda5f7b9c8 100644 --- a/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBTrigPrimTestAlgo.cc +++ b/SimCalorimetry/EcalEBTrigPrimAlgos/src/EcalEBTrigPrimTestAlgo.cc @@ -39,36 +39,51 @@ const unsigned int EcalEBTrigPrimTestAlgo::nrSamples_ = 5; const unsigned int EcalEBTrigPrimTestAlgo::maxNrTowers_ = 2448; const unsigned int EcalEBTrigPrimTestAlgo::maxNrSamplesOut_ = 10; -EcalEBTrigPrimTestAlgo::EcalEBTrigPrimTestAlgo( - const edm::EventSetup &setup, int nSam, int binofmax, bool tcpFormat, bool barrelOnly, bool debug, bool famos) +// not BarrelOnly +EcalEBTrigPrimTestAlgo::EcalEBTrigPrimTestAlgo(const EcalTrigTowerConstituentsMap *eTTmap, + const CaloGeometry *theGeometry, + int nSam, + int binofmax, + bool tcpFormat, + bool debug, + bool famos) + : eTTmap_(eTTmap), + theGeometry_(theGeometry), + nSamples_(nSam), + binOfMaximum_(binofmax), + tcpFormat_(tcpFormat), + barrelOnly_(false), + debug_(debug), + famos_(famos) + +{ + maxNrSamples_ = 10; + this->init(); +} + +//barrel only +EcalEBTrigPrimTestAlgo::EcalEBTrigPrimTestAlgo(int nSam, int binofmax, bool tcpFormat, bool debug, bool famos) : nSamples_(nSam), binOfMaximum_(binofmax), tcpFormat_(tcpFormat), - barrelOnly_(barrelOnly), + barrelOnly_(true), debug_(debug), famos_(famos) { maxNrSamples_ = 10; - this->init(setup); + this->init(); } //---------------------------------------------------------------------- -void EcalEBTrigPrimTestAlgo::init(const edm::EventSetup &setup) { - if (!barrelOnly_) { - //edm::ESHandle theGeometry; - // edm::ESHandle theEndcapGeometry_handle; - setup.get().get(theGeometry); - setup.get().get(eTTmap_); - } - +void EcalEBTrigPrimTestAlgo::init() { // initialise data structures initStructures(towerMapEB_); hitTowers_.resize(maxNrTowers_); linearizer_.resize(nbMaxXtals_); for (int i = 0; i < nbMaxXtals_; i++) - linearizer_[i] = new EcalFenixLinearizer(famos_); + linearizer_[i] = new EcalEBFenixLinearizer(famos_); // std::vector v; @@ -77,18 +92,18 @@ void EcalEBTrigPrimTestAlgo::init(const edm::EventSetup &setup) { for (int i = 0; i < 5; i++) lin_out_[i] = v; // - amplitude_filter_ = new EcalFenixAmplitudeFilter(); + amplitude_filter_ = new EcalEBFenixAmplitudeFilter(); filt_out_.resize(maxNrSamples_); peak_out_.resize(maxNrSamples_); // these two are dummy fgvb_out_.resize(maxNrSamples_); fgvb_out_temp_.resize(maxNrSamples_); // - peak_finder_ = new EcalFenixPeakFinder(); - fenixFormatterEB_ = new EcalFenixStripFormatEB(); + peak_finder_ = new EcalEBFenixPeakFinder(); + fenixFormatterEB_ = new EcalEBFenixStripFormatEB(); format_out_.resize(maxNrSamples_); // - fenixTcpFormat_ = new EcalFenixTcpFormat(tcpFormat_, debug_, famos_, binOfMaximum_); + fenixTcpFormat_ = new EcalEBFenixTcpFormat(tcpFormat_, debug_, famos_, binOfMaximum_); tcpformat_out_.resize(maxNrSamples_); } //---------------------------------------------------------------------- @@ -102,8 +117,7 @@ EcalEBTrigPrimTestAlgo::~EcalEBTrigPrimTestAlgo() { delete fenixTcpFormat_; } -void EcalEBTrigPrimTestAlgo::run(const edm::EventSetup &setup, - EBDigiCollection const *digi, +void EcalEBTrigPrimTestAlgo::run(EBDigiCollection const *digi, EcalEBTrigPrimDigiCollection &result, EcalEBTrigPrimDigiCollection &resultTcp) { //typedef typename Coll::Digi Digi; diff --git a/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.cc b/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.cc index e69686dfeb4cc..de56b3beee4ce 100644 --- a/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.cc +++ b/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.cc @@ -69,14 +69,24 @@ EcalEBTrigPrimProducer::EcalEBTrigPrimProducer(const edm::ParameterSet& iConfig) produces(); if (tcpFormat_) produces("formatTCP"); + if (not barrelOnly_) { + eTTmapToken_ = esConsumes(); + theGeometryToken_ = esConsumes(); + } } void EcalEBTrigPrimProducer::beginRun(edm::Run const& run, edm::EventSetup const& setup) { //ProcessHistory is guaranteed to be constant for an entire Run //binOfMaximum_ = findBinOfMaximum(fillBinOfMaximumFromHistory_,binOfMaximum_,run.processHistory()); - algo_ = std::make_unique( - setup, nSamples_, binOfMaximum_, tcpFormat_, barrelOnly_, debug_, famos_); + if (barrelOnly_) { + algo_ = std::make_unique(nSamples_, binOfMaximum_, tcpFormat_, debug_, famos_); + } else { + auto const& theGeometry = setup.getData(theGeometryToken_); + auto const& eTTmap = setup.getData(eTTmapToken_); + algo_ = std::make_unique( + &eTTmap, &theGeometry, nSamples_, binOfMaximum_, tcpFormat_, debug_, famos_); + } // get a first version of the records cacheID_ = this->getRecords(setup); nEvent_ = 0; @@ -164,7 +174,7 @@ void EcalEBTrigPrimProducer::produce(edm::Event& e, const edm::EventSetup& iSetu const EBDigiCollection* ebdigi = nullptr; ebdigi = barrelDigiHandle.product(); - algo_->run(iSetup, ebdigi, *pOut, *pOutTcp); + algo_->run(ebdigi, *pOut, *pOutTcp); if (debug_) std::cout << "produce" diff --git a/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.h b/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.h index fea01db789f55..5b70bcd345f42 100644 --- a/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.h +++ b/SimCalorimetry/EcalEBTrigPrimProducers/plugins/EcalEBTrigPrimProducer.h @@ -39,6 +39,9 @@ #include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" #include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" class EcalEBTrigPrimTestAlgo; @@ -72,6 +75,9 @@ class EcalEBTrigPrimProducer : public edm::stream::EDProducer<> { edm::ESGetToken theEcalTPGLutIdMap_Token_; edm::ESGetToken theEcalTPGTowerStatus_Token_; edm::ESGetToken theEcalTPGSpike_Token_; + //these are only used if we also handle the endcap + edm::ESGetToken eTTmapToken_; + edm::ESGetToken theGeometryToken_; int binOfMaximum_; bool fillBinOfMaximumFromHistory_; diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h index 5e5106431c37f..88bb334464b16 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixAmplitudeFilter.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_AMPLITUDE_FILTER_H -#define ECAL_FENIX_AMPLITUDE_FILTER_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXAMPLITUDEFILTER_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXAMPLITUDEFILTER_H #include #include @@ -18,18 +18,21 @@ class EcalFenixAmplitudeFilter { private: int peakFlag_[5]; int inputsAlreadyIn_; + uint32_t stripid_; int buffer_[5]; int fgvbBuffer_[5]; int weights_[5]; int shift_; int setInput(int input, int fgvb); void process(); + bool tpInfoPrintout_; int processedOutput_; int processedFgvbOutput_; public: EcalFenixAmplitudeFilter(); + EcalFenixAmplitudeFilter(bool TPinfoPrintout); virtual ~EcalFenixAmplitudeFilter(); virtual void process(std::vector &addout, std::vector &output, diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixBypassLin.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixBypassLin.h index 14348b73af5ac..f15c76ad42c50 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixBypassLin.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixBypassLin.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_BYPASS_LIN_H -#define ECAL_FENIX_BYPASS_LIN_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXBYPASSLIN_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXBYPASSLIN_H #include diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtStrip.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtStrip.h index c43a5724809d7..0aa569588a6aa 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtStrip.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtStrip.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_ET_STRIP_H -#define ECAL_FENIX_ET_STRIP_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXETSTRIPH +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXETSTRIPH #include /** diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtTot.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtTot.h index ec0bac4a8425d..a29986c7de55a 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtTot.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixEtTot.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_ET_TOT_H -#define ECAL_FENIX_ET_TOT_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXETTOT_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXETTOT_H #include "DataFormats/EcalDigi/interface/EBDataFrame.h" #include @@ -8,7 +8,9 @@ \class EcalFenixEtTot \brief class for calculation of Et for Fenix tcp - * calculates the sum + * calculates the sum. + * As in the firmware the Et sum is splitted in even and odd sum according to the OddEvenBit. + * The bit (14th) is handled by strip. * * inputs: * -5x 12 bits (12 first bits of output of passlin or take 13 bits and @@ -17,6 +19,7 @@ 5X 10 bits (10 first bits) according to the second parameter) * -number of interesting bits according EE or EBDataFrame + -mask to apply before checking for oddEven flaf * * output :12 bits (EB) or 10(EE) * @@ -28,7 +31,12 @@ class EcalFenixEtTot { virtual ~EcalFenixEtTot(); virtual std::vector process(const std::vector &); - void process(std::vector> &, int nStr, int bitMask, std::vector &out); + void process(std::vector> &, + int nStr, + int bitMask, + int bitOddEven, + std::vector &out_even, + std::vector &out_odd); private: }; diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixFgvbEB.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixFgvbEB.h index b2d27426826ca..4e914bc228fca 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixFgvbEB.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixFgvbEB.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_FGVB_EB_H -#define ECAL_FENIX_FGVB_EB_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXFGVBEB_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXFGVBEB_H #include #include diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixLinearizer.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixLinearizer.h index c5755b21b2a8f..1b75de8fbd3b5 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixLinearizer.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixLinearizer.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_LINEARIZER_H -#define ECAL_FENIX_LINEARIZER_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXLINEARIZER_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXLINEARIZER_H #include #include diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixMaxof2.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixMaxof2.h index 61538bcec3ec2..b9a76c64bd2de 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixMaxof2.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixMaxof2.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_MAXOF2_H -#define ECAL_FENIX_MAXOF2_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXMAXOF2_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXMAXOF2_H #include @@ -12,6 +12,8 @@ * computes 4 sums of 2 strips and gives the max * max limited by 0xfff * + * As in the firmware the computation is performed only on the even energy sum, + * so the oddEvenFlag (14th bit) is used to exclude the energy of the odd strips from the computation. D.Valsecchi. * */ @@ -19,7 +21,7 @@ class EcalFenixMaxof2 { public: EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips); virtual ~EcalFenixMaxof2(); - void process(std::vector> &, int nStr, int bitMask, std::vector &out); + void process(std::vector> &, int nStr, int bitMask, int bitOddEven, std::vector &out); private: int nbMaxStrips_; diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixOddAmplitudeFilter.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixOddAmplitudeFilter.h new file mode 100644 index 0000000000000..2e55f96007ce9 --- /dev/null +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixOddAmplitudeFilter.h @@ -0,0 +1,45 @@ +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXODDAMPLITUDEFILTER_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXODDAMPLITUDEFILTER_H + +#include +#include +#include + +class EcalTPGOddWeightIdMap; +class EcalTPGOddWeightGroup; + +/** + \ class EcalFenixOddAmplitudeFilter + * The purpose of this class is to implement the second (odd) ECAL FENIX amplitude filter + * Derived from SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc, interface/EcalFenixAmplitudeFilter.h + * input: 18 bits + * output: 18 bits + * + */ +class EcalFenixOddAmplitudeFilter { +private: + int peakFlag_[5]; + int inputsAlreadyIn_; + uint32_t stripid_; + int buffer_[5]; + int weights_[5]; + int shift_; + bool debug_; + bool tpInfoPrintout_; + int setInput(int input); + void process(); + + int processedOutput_; + int processedFgvbOutput_; + +public: + EcalFenixOddAmplitudeFilter(); + EcalFenixOddAmplitudeFilter(bool TPinfoPrintout); + virtual ~EcalFenixOddAmplitudeFilter(); + virtual void process(std::vector &addout, std::vector &output); + void setParameters(uint32_t raw, + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap, + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup); +}; + +#endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixPeakFinder.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixPeakFinder.h index bc55d0fd4fd42..0fe08e8d2e2c5 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixPeakFinder.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixPeakFinder.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_PEAKFINDER_H -#define ECAL_FENIX_PEAKFINDER_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXPEAKFINDER_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXPEAKFINDER_H #include diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStrip.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStrip.h index 082c7346fa649..4038ac52b6510 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStrip.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStrip.h @@ -1,7 +1,8 @@ -#ifndef ECAL_FENIXSTRIP_H -#define ECAL_FENIXSTRIP_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIP_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIP_H #include +#include #include #include #include @@ -11,6 +12,7 @@ #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" #include #include +#include class EBDataFrame; class EcalTriggerPrimitiveSample; @@ -20,6 +22,7 @@ class EcalFenixStripFgvbEE; class EcalFenixStripFormatEB; class EcalFenixStripFormatEE; class EcalTPGStripStatus; +class EcalTPGTPMode; /** \class EcalFenixStrip @@ -28,7 +31,12 @@ class EcalTPGStripStatus; class EcalFenixStrip { public: // constructor, destructor - EcalFenixStrip(const EcalElectronicsMapping *theMapping, bool debug, bool famos, int maxNrSamples, int nbMaxXtals); + EcalFenixStrip(const EcalElectronicsMapping *theMapping, + bool debug, + bool famos, + int maxNrSamples, + int nbMaxXtals, + bool TPinfoPrintout); virtual ~EcalFenixStrip(); private: @@ -37,10 +45,12 @@ class EcalFenixStrip { bool debug_; bool famos_; int nbMaxXtals_; + bool tpInfoPrintout_; std::vector linearizer_; EcalFenixAmplitudeFilter *amplitude_filter_; + EcalFenixOddAmplitudeFilter *oddAmplitude_filter_; EcalFenixPeakFinder *peak_finder_; @@ -55,8 +65,15 @@ class EcalFenixStrip { // data formats for each event std::vector> lin_out_; std::vector add_out_; - std::vector filt_out_; - std::vector peak_out_; + + // Data formats for even filter. Up to the adder only 1 path, then splitted. + std::vector even_filt_out_; + std::vector even_peak_out_; + + // Data formats for odd filter, as data path is duplicated for odd filter + std::vector odd_filt_out_; + std::vector odd_peak_out_; + std::vector format_out_; std::vector fgvb_out_; std::vector fgvb_out_temp_; @@ -65,10 +82,13 @@ class EcalFenixStrip { const EcalTPGLinearizationConst *ecaltpLin_; const EcalTPGWeightIdMap *ecaltpgWeightMap_; const EcalTPGWeightGroup *ecaltpgWeightGroup_; + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap_; + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup_; const EcalTPGSlidingWindow *ecaltpgSlidW_; const EcalTPGFineGrainStripEE *ecaltpgFgStripEE_; const EcalTPGCrystalStatus *ecaltpgBadX_; const EcalTPGStripStatus *ecaltpgStripStatus_; + const EcalTPGTPMode *ecaltpgTPMode_; bool identif_; @@ -77,21 +97,42 @@ class EcalFenixStrip { const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup, + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap, + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup, const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE, const EcalTPGCrystalStatus *ecaltpgBadX, - const EcalTPGStripStatus *ecaltpgStripStatus) { + const EcalTPGStripStatus *ecaltpgStripStatus, + const EcalTPGTPMode *ecaltpgTPMode) { ecaltpPed_ = ecaltpPed; ecaltpLin_ = ecaltpLin; ecaltpgWeightMap_ = ecaltpgWeightMap; ecaltpgWeightGroup_ = ecaltpgWeightGroup; + ecaltpgOddWeightMap_ = ecaltpgOddWeightMap; + ecaltpgOddWeightGroup_ = ecaltpgOddWeightGroup; ecaltpgSlidW_ = ecaltpgSlidW; ecaltpgFgStripEE_ = ecaltpgFgStripEE; ecaltpgBadX_ = ecaltpgBadX; ecaltpgStripStatus_ = ecaltpgStripStatus; + ecaltpgTPMode_ = ecaltpgTPMode; } // main methods + void process(std::vector &samples, int nrXtals, std::vector &out); + void process(std::vector &samples, int nrXtals, std::vector &out); + + template + void process_part1(int identif, + std::vector &df, + int nrXtals, + uint32_t stripid, + const EcalTPGPedestals *ecaltpPed, + const EcalTPGLinearizationConst *ecaltpLin, + const EcalTPGWeightIdMap *ecaltpgWeightMap, + const EcalTPGWeightGroup *ecaltpgWeightGroup, + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap, + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup, + const EcalTPGCrystalStatus *ecaltpBadX); // process method is splitted in 2 parts: // the first one is overloaded, the same except input // the second part is slightly different for barrel/endcap @@ -108,7 +149,8 @@ class EcalFenixStrip { EcalFenixLinearizer *getLinearizer(int i) const { return linearizer_[i]; } EcalFenixEtStrip *getAdder() const { return adder_; } - EcalFenixAmplitudeFilter *getFilter() const { return amplitude_filter_; } + EcalFenixAmplitudeFilter *getEvenFilter() const { return amplitude_filter_; } + EcalFenixOddAmplitudeFilter *getOddFilter() const { return oddAmplitude_filter_; } EcalFenixPeakFinder *getPeakFinder() const { return peak_finder_; } EcalFenixStripFormatEB *getFormatterEB() const { return fenixFormatterEB_; } @@ -118,159 +160,5 @@ class EcalFenixStrip { void setbadStripMissing(bool flag) { identif_ = flag; } bool getbadStripMissing() const { return identif_; } - - // ========================= implementations - // ============================================================== - void process(std::vector &samples, int nrXtals, std::vector &out) { - // now call processing - if (samples.empty()) { - std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl; - return; - } - const EcalTriggerElectronicsId elId = theMapping_->getTriggerElectronicsId(samples[0].id()); - uint32_t stripid = elId.rawId() & 0xfffffff8; // from Pascal - - identif_ = getFGVB()->getMissedStripFlag(); - - process_part1(identif_, - samples, - nrXtals, - stripid, - ecaltpPed_, - ecaltpLin_, - ecaltpgWeightMap_, - ecaltpgWeightGroup_, - ecaltpgBadX_); // templated part - process_part2_barrel(stripid, ecaltpgSlidW_, - ecaltpgFgStripEE_); // part different for barrel/endcap - out = format_out_; - } - - void process(std::vector &samples, int nrXtals, std::vector &out) { - // now call processing - if (samples.empty()) { - std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl; - return; - } - const EcalTriggerElectronicsId elId = theMapping_->getTriggerElectronicsId(samples[0].id()); - uint32_t stripid = elId.rawId() & 0xfffffff8; // from Pascal - - identif_ = getFGVB()->getMissedStripFlag(); - - process_part1(identif_, - samples, - nrXtals, - stripid, - ecaltpPed_, - ecaltpLin_, - ecaltpgWeightMap_, - ecaltpgWeightGroup_, - ecaltpgBadX_); // templated part - process_part2_endcap(stripid, ecaltpgSlidW_, ecaltpgFgStripEE_, ecaltpgStripStatus_); - out = format_out_; // FIXME: timing - return; - } - - template - void process_part1(int identif, - std::vector &df, - int nrXtals, - uint32_t stripid, - const EcalTPGPedestals *ecaltpPed, - const EcalTPGLinearizationConst *ecaltpLin, - const EcalTPGWeightIdMap *ecaltpgWeightMap, - const EcalTPGWeightGroup *ecaltpgWeightGroup, - const EcalTPGCrystalStatus *ecaltpBadX) { - if (debug_) - std::cout << "\n\nEcalFenixStrip input is a vector of size: " << nrXtals << std::endl; - - // loop over crystals - for (int cryst = 0; cryst < nrXtals; cryst++) { - if (debug_) { - std::cout << std::endl; - std::cout << "cryst= " << cryst << " EBDataFrame/EEDataFrame is: " << std::endl; - for (int i = 0; i < df[cryst].size(); i++) { - std::cout << " " << std::dec << df[cryst][i].adc(); - } - std::cout << std::endl; - } - // call linearizer - this->getLinearizer(cryst)->setParameters(df[cryst].id().rawId(), ecaltpPed, ecaltpLin, ecaltpBadX); - this->getLinearizer(cryst)->process(df[cryst], lin_out_[cryst]); - } - - if (debug_) { - std::cout << "output of linearizer is a vector of size: " << std::dec << lin_out_.size() << " of which used " - << nrXtals << std::endl; - for (int ix = 0; ix < nrXtals; ix++) { - std::cout << "cryst: " << ix << " value : " << std::dec << std::endl; - std::cout << " lin_out[ix].size()= " << std::dec << lin_out_[ix].size() << std::endl; - for (unsigned int i = 0; i < lin_out_[ix].size(); i++) { - std::cout << " " << std::dec << (lin_out_[ix])[i]; - } - std::cout << std::endl; - } - - std::cout << std::endl; - } - - // Now call the sFGVB - this is common between EB and EE! - getFGVB()->setParameters(identif, stripid, ecaltpgFgStripEE_); - getFGVB()->process(lin_out_, fgvb_out_temp_); - - if (debug_) { - std::cout << "output of strip fgvb is a vector of size: " << std::dec << fgvb_out_temp_.size() << std::endl; - for (unsigned int i = 0; i < fgvb_out_temp_.size(); i++) { - std::cout << " " << std::dec << (fgvb_out_temp_[i]); - } - std::cout << std::endl; - } - - // call adder - this->getAdder()->process(lin_out_, nrXtals, add_out_); // add_out is of size SIZEMAX=maxNrSamples - - if (debug_) { - std::cout << "output of adder is a vector of size: " << std::dec << add_out_.size() << std::endl; - for (unsigned int ix = 0; ix < add_out_.size(); ix++) { - std::cout << "cryst: " << ix << " value : " << std::dec << add_out_[ix] << std::endl; - } - std::cout << std::endl; - } - - if (famos_) { - filt_out_[0] = add_out_[0]; - peak_out_[0] = add_out_[0]; - return; - } else { - // call amplitudefilter - this->getFilter()->setParameters(stripid, ecaltpgWeightMap, ecaltpgWeightGroup); - this->getFilter()->process(add_out_, filt_out_, fgvb_out_temp_, fgvb_out_); - - if (debug_) { - std::cout << "output of filter is a vector of size: " << std::dec << filt_out_.size() << std::endl; - for (unsigned int ix = 0; ix < filt_out_.size(); ix++) { - std::cout << "cryst: " << ix << " value : " << std::dec << filt_out_[ix] << std::endl; - } - std::cout << std::endl; - - std::cout << "output of sfgvb after filter is a vector of size: " << std::dec << fgvb_out_.size() << std::endl; - for (unsigned int ix = 0; ix < fgvb_out_.size(); ix++) { - std::cout << "cryst: " << ix << " value : " << std::dec << fgvb_out_[ix] << std::endl; - } - std::cout << std::endl; - } - - // call peakfinder - this->getPeakFinder()->process(filt_out_, peak_out_); - if (debug_) { - std::cout << "output of peakfinder is a vector of size: " << peak_out_.size() << std::endl; - for (unsigned int ix = 0; ix < peak_out_.size(); ix++) { - std::cout << "cryst: " << ix << " value : " << peak_out_[ix] << std::endl; - } - std::cout << std::endl; - } - return; - } - } }; #endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h index 02e45b34db240..d5fc4a575a355 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIXSTRIP_FGVB_EE_H -#define ECAL_FENIXSTRIP_FGVB_EE_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIPFGVBEE_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIPFGVBEE_H #include #include diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEB.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEB.h index 7d39c01928c22..64b2302d1d0dc 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEB.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEB.h @@ -1,10 +1,11 @@ -#ifndef ECAL_FENIX_STRIP_FORMAT_EB_H -#define ECAL_FENIX_STRIP_FORMAT_EB_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIPFORMATEB_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIPFORMATEB_H #include #include class EcalTPGSlidingWindow; +class EcalTPGTPMode; /** \class EcalFenixStripFormatEB @@ -18,18 +19,26 @@ class EcalTPGSlidingWindow; class EcalFenixStripFormatEB { private: int inputsFGVB_; - int inputPeak_; - int input_; + int inputEvenPeak_; + int inputOddPeak_; + int input_even_; + int input_odd_; uint32_t shift_; + const EcalTPGTPMode *ecaltpgTPMode_; // int buffer_; - int setInput(int input, int inputPeak, int inputsFGVB); + int setInput(int input_even, int inputEvenPeak, int input_odd, int inputOddPeak, int inputsFGVB); int process(); public: EcalFenixStripFormatEB(); virtual ~EcalFenixStripFormatEB(); - virtual void process(std::vector &, std::vector &, std::vector &, std::vector &); - void setParameters(uint32_t &, const EcalTPGSlidingWindow *&); + virtual void process(std::vector &sFGVBout, + std::vector &peakout_even, + std::vector &filtout_even, + std::vector &peakout_odd, + std::vector &filtout_odd, + std::vector &output); + void setParameters(uint32_t &, const EcalTPGSlidingWindow *&, const EcalTPGTPMode *); }; #endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEE.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEE.h index 7586fe1659024..ee050c418aaf2 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEE.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEE.h @@ -1,11 +1,12 @@ -#ifndef ECAL_FENIX_STRIP_FORMAT_EE_H -#define ECAL_FENIX_STRIP_FORMAT_EE_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIPFORMATEE_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXSTRIPFORMATEE_H #include #include class EcalTPGSlidingWindow; class EcalTPGStripStatus; +class EcalTPGTPMode; /** \class EcalFenixStripFormatEE @@ -18,21 +19,29 @@ class EcalTPGStripStatus; class EcalFenixStripFormatEE { private: - int inputPeak_; - int input_; + int inputEvenPeak_; + int inputOddPeak_; + int input_even_; + int input_odd_; uint32_t shift_; int fgvb_; uint16_t stripStatus_; + const EcalTPGTPMode *ecaltpgTPMode_; - int setInput(int input, int inputPeak, int fgvb); + int setInput(int input_even, int inputEvenPeak, int input_odd, int inputOddPeak, int fgvb); int process(); public: EcalFenixStripFormatEE(); virtual ~EcalFenixStripFormatEE(); - virtual void process(std::vector &, std::vector &, std::vector &, std::vector &); - void setParameters(uint32_t id, const EcalTPGSlidingWindow *&, const EcalTPGStripStatus *); + virtual void process(std::vector &fgvbout, + std::vector &peakout_even, + std::vector &filtout_even, + std::vector &peakout_odd, + std::vector &filtout_odd, + std::vector &output); + void setParameters(uint32_t id, const EcalTPGSlidingWindow *&, const EcalTPGStripStatus *, const EcalTPGTPMode *); }; #endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcp.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcp.h index f61a82c1401b8..3cb4ca94c9888 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcp.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcp.h @@ -1,12 +1,13 @@ -#ifndef ECAL_FENIX_TCP_H -#define ECAL_FENIX_TCP_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCP_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCP_H #include #include #include #include #include -#include +#include +#include #include #include @@ -23,6 +24,7 @@ class EcalTPGFineGrainEBIdMap; class EcalTPGFineGrainTowerEE; class EcalTrigTowerDetId; class EcalTPGTowerStatus; +class EcalTPGTPMode; /** \class EcalFenixTcp @@ -31,8 +33,8 @@ class EcalTPGTowerStatus; class EcalFenixTcp { private: bool debug_; - int nbMaxStrips_; + bool tpInfoPrintout_; EcalFenixMaxof2 *maxOf2_; std::vector bypasslin_; @@ -41,11 +43,13 @@ class EcalFenixTcp { EcalFenixTcpFgvbEE *fgvbEE_; EcalFenixTcpsFgvbEB *sfgvbEB_; - EcalFenixTcpFormat *formatter_; + EcalFenixTcpFormatEB *formatter_EB_; + EcalFenixTcpFormatEE *formatter_EE_; // permanent data structures std::vector> bypasslin_out_; - std::vector adder_out_; + std::vector adder_even_out_; + std::vector adder_odd_out_; std::vector maxOf2_out_; std::vector fgvb_out_; std::vector strip_fgvb_out_; @@ -58,7 +62,8 @@ class EcalFenixTcp { const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, const EcalTPGTowerStatus *ecaltpgBadTT, - const EcalTPGSpike *ecaltpgSpike) { + const EcalTPGSpike *ecaltpgSpike, + const EcalTPGTPMode *ecaltpgTPMode) { ecaltpgFgEBGroup_ = ecaltpgFgEBGroup; ecaltpgLutGroup_ = ecaltpgLutGroup; ecaltpgLut_ = ecaltpgLut; @@ -66,10 +71,12 @@ class EcalFenixTcp { ecaltpgFineGrainTowerEE_ = ecaltpgFineGrainTowerEE; ecaltpgBadTT_ = ecaltpgBadTT; ecaltpgSpike_ = ecaltpgSpike; + ecaltpgTPMode_ = ecaltpgTPMode; } // end temporary, for timing tests - EcalFenixTcp(bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips); + EcalFenixTcp( + bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips, bool TPinfoPrintout); virtual ~EcalFenixTcp(); void process(std::vector &bid, // dummy argument for template call @@ -87,11 +94,12 @@ class EcalFenixTcp { bool isInInnerRings, EcalTrigTowerDetId thisTower); - void process_part1(std::vector> &tpframetow, int nStr, int bitMask); + void process_part1(std::vector> &tpframetow, int nStr, int bitMask, int bitOddEven); void process_part2_barrel(std::vector> &, int nStr, int bitMask, + int bitOddEven, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, @@ -105,6 +113,7 @@ class EcalFenixTcp { void process_part2_endcap(std::vector> &, int nStr, int bitMask, + int bitOddEven, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, @@ -117,7 +126,8 @@ class EcalFenixTcp { EcalFenixBypassLin *getBypasslin(int i) const { return bypasslin_[i]; } EcalFenixEtTot *getAdder() const { return adder_; } EcalFenixMaxof2 *getMaxOf2() const { return maxOf2_; } - EcalFenixTcpFormat *getFormatter() const { return formatter_; } + EcalFenixTcpFormatEB *getFormatterEB() const { return formatter_EB_; } + EcalFenixTcpFormatEE *getFormatterEE() const { return formatter_EE_; } EcalFenixFgvbEB *getFGVBEB() const { return fgvbEB_; } EcalFenixTcpFgvbEE *getFGVBEE() const { return fgvbEE_; } EcalFenixTcpsFgvbEB *getsFGVBEB() const { return sfgvbEB_; } @@ -129,6 +139,7 @@ class EcalFenixTcp { const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE_; const EcalTPGTowerStatus *ecaltpgBadTT_; const EcalTPGSpike *ecaltpgSpike_; + const EcalTPGTPMode *ecaltpgTPMode_; }; #endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFgvbEE.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFgvbEE.h index a86330dd23a08..cd4ffca87b15b 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFgvbEE.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFgvbEE.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIXTCP_FGVB_EE_H -#define ECAL_FENIXTCP_FGVB_EE_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCPFGVBEE_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCPFGVBEE_H #include #include diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEB.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEB.h new file mode 100644 index 0000000000000..21076c98d2831 --- /dev/null +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEB.h @@ -0,0 +1,58 @@ +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCPFORMATEB_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCPFORMATEB_H + +#include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h" +#include + +class EcalTPGLutGroup; +class EcalTPGLutIdMap; +class EcalTPGTowerStatus; +class EcalTPGSpike; +class EcalTPGTPMode; + +/** + \class EcalFenixStripFormat + \brief Formatting for Fenix Tcp EB + * input 10 bits from Ettot + * 1 bit from fgvb / ODD>even flag + * 3 bits TriggerTowerFlag + * output: 16 bits + * simple formatting + * + * Using even_sum and odd_sum as inputs. Deciding the option with TPmode options + */ +class EcalFenixTcpFormatEB { +public: + EcalFenixTcpFormatEB(bool tccFormat, bool debug, bool famos, int binOfMax); + virtual ~EcalFenixTcpFormatEB(); + virtual std::vector process(const std::vector &, const std::vector &) { + std::vector v; + return v; + } + void process(std::vector &Et_even_sum, + std::vector &Et_odd_sum, + std::vector &fgvb, + std::vector &sfgvb, + int eTTotShift, + std::vector &out, + std::vector &outTcc); + void setParameters(uint32_t towid, + const EcalTPGLutGroup *ecaltpgLutGroup, + const EcalTPGLutIdMap *ecaltpgLut, + const EcalTPGTowerStatus *ecaltpgbadTT, + const EcalTPGSpike *ecaltpgSpike, + const EcalTPGTPMode *ecaltpgTPMode); + +private: + const unsigned int *lut_; + const uint16_t *badTTStatus_; + uint16_t status_; + bool tcpFormat_; + bool debug_; + bool famos_; + unsigned int binOfMax_; + uint16_t spikeZeroThresh_; + const EcalTPGTPMode *ecaltpgTPMode_; +}; + +#endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormat.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEE.h similarity index 66% rename from SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormat.h rename to SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEE.h index ce96d16d213f5..d608d663c619d 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormat.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixTcpFormatEE.h @@ -1,5 +1,5 @@ -#ifndef ECAL_FENIX_TCP_FORMAT_H -#define ECAL_FENIX_TCP_FORMAT_H +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCPFORMATEE_H +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXTCPFORMATEE_H #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h" #include @@ -8,10 +8,11 @@ class EcalTPGLutGroup; class EcalTPGLutIdMap; class EcalTPGTowerStatus; class EcalTPGSpike; +class EcalTPGTPMode; /** - \class EcalFenixStripFormat - \brief Formatting for Fenix Tcp + \class EcalFenixStripFormatEE + \brief Formatting for Fenix Tcp EE * input 10 bits from Ettot * 1 bit from fgvb * 3 bits TriggerTowerFlag @@ -19,15 +20,16 @@ class EcalTPGSpike; * simple formatting * */ -class EcalFenixTcpFormat { +class EcalFenixTcpFormatEE { public: - EcalFenixTcpFormat(bool tccFormat, bool debug, bool famos, int binOfMax); - virtual ~EcalFenixTcpFormat(); + EcalFenixTcpFormatEE(bool tccFormat, bool debug, bool famos, int binOfMax); + virtual ~EcalFenixTcpFormatEE(); virtual std::vector process(const std::vector &, const std::vector &) { std::vector v; return v; } - void process(std::vector &Et, + void process(std::vector &Et_even_sum, + std::vector &Et_odd_sum, std::vector &fgvb, std::vector &sfgvb, int eTTotShift, @@ -38,7 +40,8 @@ class EcalFenixTcpFormat { const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, - const EcalTPGSpike *ecaltpgSpike); + const EcalTPGSpike *ecaltpgSpike, + const EcalTPGTPMode *ecaltpgTPMode); private: const unsigned int *lut_; @@ -49,6 +52,7 @@ class EcalFenixTcpFormat { bool famos_; unsigned int binOfMax_; uint16_t spikeZeroThresh_; + const EcalTPGTPMode *ecaltpgTPMode_; }; #endif diff --git a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalTrigPrimFunctionalAlgo.h b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalTrigPrimFunctionalAlgo.h index e7952eea1a762..42141f3eade80 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalTrigPrimFunctionalAlgo.h +++ b/SimCalorimetry/EcalTrigPrimAlgos/interface/EcalTrigPrimFunctionalAlgo.h @@ -1,5 +1,5 @@ -#ifndef EcalTrigPrimFunctionalAlgo_h -#define EcalTrigPrimFunctionalAlgo_h +#ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALTRIGPRIMFUNCTIONALALGO_h +#define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALTRIGPRIMFUNCTIONALALGO_h /** \class EcalTrigPrimFunctionalAlgo * * EcalTrigPrimFunctionalAlgo is the main algorithm class for TPG @@ -7,7 +7,7 @@ * Structure is as close as possible to electronics * * - * \author Ursula Berthon, Stephanie Baffioni, LLR Palaiseau + * \author Ursula Berthon, Stephanie Baffioni, LLR Palaiseau * * \version 1st Version may 2006 * \version 2nd Version jul 2006 @@ -31,6 +31,7 @@ #include #include +#include /** Main Algo for Ecal trigger primitives. */ @@ -51,11 +52,16 @@ class EcalTrigPrimFunctionalAlgo { int binofmax, bool tcpFormat, bool debug, - bool famos); + bool famos, + bool TPinfoPrintout); //barrel only - explicit EcalTrigPrimFunctionalAlgo( - const EcalElectronicsMapping *theMapping, int binofmax, bool tcpFormat, bool debug, bool famos); + explicit EcalTrigPrimFunctionalAlgo(const EcalElectronicsMapping *theMapping, + int binofmax, + bool tcpFormat, + bool debug, + bool famos, + bool TPinfoPrintout); virtual ~EcalTrigPrimFunctionalAlgo(); @@ -74,17 +80,23 @@ class EcalTrigPrimFunctionalAlgo { const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup, + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap, + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE, const EcalTPGCrystalStatus *ecaltpgBadX, - const EcalTPGStripStatus *ecaltpgStripStatus) { + const EcalTPGStripStatus *ecaltpgStripStatus, + const EcalTPGTPMode *ecaltpgTPMode) { estrip_->setPointers(ecaltpPed, ecaltpLin, ecaltpgWeightMap, ecaltpgWeightGroup, + ecaltpgOddWeightMap, + ecaltpgOddWeightGroup, ecaltpgSlidW, ecaltpgFgStripEE, ecaltpgBadX, - ecaltpgStripStatus); + ecaltpgStripStatus, + ecaltpgTPMode); } void setPointers2(const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGLutGroup *ecaltpgLutGroup, @@ -92,14 +104,16 @@ class EcalTrigPrimFunctionalAlgo { const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, const EcalTPGTowerStatus *ecaltpgBadTT, - const EcalTPGSpike *ecaltpgSpike) { + const EcalTPGSpike *ecaltpgSpike, + const EcalTPGTPMode *ecaltpgTPMode) { etcp_->setPointers(ecaltpgFgEBGroup, ecaltpgLutGroup, ecaltpgLut, ecaltpgFineGrainEB, ecaltpgFineGrainTowerEE, ecaltpgBadTT, - ecaltpgSpike); + ecaltpgSpike, + ecaltpgTPMode); } private: @@ -139,6 +153,7 @@ class EcalTrigPrimFunctionalAlgo { bool barrelOnly_; bool debug_; bool famos_; + bool tpInfoPrintout_; static const unsigned int nrSamples_; // nr samples to write, should not be changed since by // convention the size means that it is coming from simulation @@ -184,6 +199,10 @@ void EcalTrigPrimFunctionalAlgo::run_part2( estrip_->getFGVB()->setbadStripMissing(false); for (int itow = 0; itow < nrTowers_; ++itow) { + if (tpInfoPrintout_) { + std::cout << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; + std::cout << "on Tower " << itow << " of " << nrTowers_ << std::endl; + } int index = hitTowers_[itow].first; const EcalTrigTowerDetId &thisTower = hitTowers_[itow].second; @@ -194,6 +213,10 @@ void EcalTrigPrimFunctionalAlgo::run_part2( // size; nr of crystals/strip if ((towerMap[index])[i].first > 0) { + if (tpInfoPrintout_) { + std::cout << "-------------------------------------------------" << std::endl; + std::cout << "on Strip index " << i << std::endl; + } estrip_->process(df, (towerMap[index])[i].first, striptp_[nstr++]); } } // loop over strips in one tower diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc index 7fbddbc3b82ae..ffcc959b66834 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixAmplitudeFilter.cc @@ -5,13 +5,14 @@ #include #include -EcalFenixAmplitudeFilter::EcalFenixAmplitudeFilter() : inputsAlreadyIn_(0), shift_(6) {} +EcalFenixAmplitudeFilter::EcalFenixAmplitudeFilter(bool tpInfoPrintout) + : inputsAlreadyIn_(0), stripid_{0}, shift_(6), tpInfoPrintout_(tpInfoPrintout) {} EcalFenixAmplitudeFilter::~EcalFenixAmplitudeFilter() {} int EcalFenixAmplitudeFilter::setInput(int input, int fgvb) { if (input > 0X3FFFF) { - std::cout << "ERROR IN INPUT OF AMPLITUDE FILTER" << std::endl; + edm::LogError("EcalTPG") << "ERROR IN INPUT OF EVEN AMPLITUDE FILTER"; return -1; } if (inputsAlreadyIn_ < 5) { @@ -36,13 +37,16 @@ void EcalFenixAmplitudeFilter::process(std::vector &addout, // test inputsAlreadyIn_ = 0; for (unsigned int i = 0; i < 5; i++) { - buffer_[i] = 0; // FIXME: 5 + buffer_[i] = 0; fgvbBuffer_[i] = 0; } - // test end for (unsigned int i = 0; i < addout.size(); i++) { + // Only save TP info for Clock i >= 4 (from 0-9) because first 5 digis required to produce first ET value + if (i >= 4 && tpInfoPrintout_) { + std::cout << i << std::dec; + } setInput(addout[i], fgvbIn[i]); process(); output[i] = processedOutput_; @@ -81,11 +85,28 @@ void EcalFenixAmplitudeFilter::process() { output = 0X3FFFF; processedOutput_ = output; processedFgvbOutput_ = fgvbInt; + + if (tpInfoPrintout_) { + std::cout << " " << stripid_; + for (int i = 0; i < 5; i++) { + std::cout << " " << weights_[i] << std::dec; + } + for (int i = 0; i < 5; i++) { + std::cout << " " << weights_[i] / 64.0 << std::dec; + } + for (int i = 0; i < 5; i++) { + std::cout << " " << buffer_[i] << std::dec; + } // digis + std::cout << " --> output: " << output; + std::cout << " EVEN"; + std::cout << std::endl; + } } void EcalFenixAmplitudeFilter::setParameters(uint32_t raw, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup) { + stripid_ = raw; uint32_t params_[5]; const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgWeightGroup->getMap(); EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(raw); @@ -95,18 +116,9 @@ void EcalFenixAmplitudeFilter::setParameters(uint32_t raw, EcalTPGWeightIdMap::EcalTPGWeightMapItr itw = weightmap.find(weightid); (*itw).second.getValues(params_[0], params_[1], params_[2], params_[3], params_[4]); - // we have to transform negative coded in 7 bits into negative coded in 32 - // bits maybe this should go into the getValue method?? - // std::cout << "peak flag settings" << std::endl; for (int i = 0; i < 5; ++i) { weights_[i] = (params_[i] & 0x40) ? (int)(params_[i] | 0xffffffc0) : (int)(params_[i]); - - // Construct the peakFlag for sFGVB processing - // peakFlag_[i] = ((params_[i] & 0x80) > 0x0) ? 1 : 0; - // std::cout << " " << params_[i] << std::endl; - // std::cout << " " << peakFlag_[i] << std::endl; } - // std::cout << std::endl; } else edm::LogWarning("EcalTPG") << " could not find EcalTPGGroupsMap entry for " << raw; } diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixEtTot.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixEtTot.cc index d70968e746650..4e7d5367c0d73 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixEtTot.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixEtTot.cc @@ -13,18 +13,28 @@ std::vector EcalFenixEtTot::process(const std::vector &calod void EcalFenixEtTot::process(std::vector> &bypasslinout, int nStr, int bitMask, - std::vector &output) { - for (unsigned int i = 0; i < output.size(); i++) { - output[i] = 0; + int bitOddEven, + std::vector &output_even, + std::vector &output_odd) { + for (unsigned int i = 0; i < output_even.size(); i++) { + output_even[i] = 0; + output_odd[i] = 0; } int mask = (1 << bitMask) - 1; for (int istrip = 0; istrip < nStr; istrip++) { for (unsigned int i = 0; i < bypasslinout[istrip].size(); i++) { - output[i] += (bypasslinout[istrip][i] & mask); // fix bug inn case of EE: MSB are set for FG, so + int output = (bypasslinout[istrip][i] & mask); // fix bug inn case of EE: MSB are set for FG, so // need to apply mask in summation. - if (output[i] > mask) - output[i] = mask; + if (output > mask) + output = mask; + // Check the oddeven flag to assign the amplitude to the correct sum + // If the feature is off in the strip fenix the bit will be always 0 and only the even sum will be summed + if ((bypasslinout[istrip][i] >> bitOddEven) & 1) { + output_odd[i] += output; + } else { + output_even[i] += output; + } } } return; diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixMaxof2.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixMaxof2.cc index ca2e74041da23..0b83b8ba99d05 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixMaxof2.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixMaxof2.cc @@ -10,23 +10,34 @@ EcalFenixMaxof2::EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips) : nbMaxStrip EcalFenixMaxof2::~EcalFenixMaxof2() {} -void EcalFenixMaxof2::process(std::vector> &bypasslinout, - int nstrip, - int bitMask, - std::vector &output) { +void EcalFenixMaxof2::process( + std::vector> &bypasslinout, int nstrip, int bitMask, int bitOddEven, std::vector &output) { int mask = (1 << bitMask) - 1; + bool strip_oddmask[nstrip][output.size()]; + for (int i2strip = 0; i2strip < nstrip - 1; ++i2strip) for (unsigned int i = 0; i < output.size(); i++) sumby2_[i2strip][i] = 0; for (unsigned int i = 0; i < output.size(); i++) output[i] = 0; + // Prepare also the mask of strips to be avoided because of the odd>even energy flag + for (int istrip = 0; istrip < nstrip; ++istrip) { + for (unsigned int i = 0; i < output.size(); i++) { + if ((bypasslinout[istrip][i] >> bitOddEven) & 1) + strip_oddmask[istrip][i] = false; + else + strip_oddmask[istrip][i] = true; + } + } + for (unsigned int i = 0; i < output.size(); i++) { if (nstrip - 1 == 0) { - output[i] = ((bypasslinout[0][i]) & mask); + output[i] = strip_oddmask[0][i] * ((bypasslinout[0][i]) & mask); } else { for (int i2strip = 0; i2strip < nstrip - 1; ++i2strip) { - sumby2_[i2strip][i] = ((bypasslinout[i2strip][i]) & mask) + ((bypasslinout[i2strip + 1][i]) & mask); + sumby2_[i2strip][i] = strip_oddmask[i2strip][i] * ((bypasslinout[i2strip][i]) & mask) + + strip_oddmask[i2strip + 1][i] * ((bypasslinout[i2strip + 1][i]) & mask); if (sumby2_[i2strip][i] > output[i]) { output[i] = sumby2_[i2strip][i]; } diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixOddAmplitudeFilter.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixOddAmplitudeFilter.cc new file mode 100644 index 0000000000000..14bc96354747e --- /dev/null +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixOddAmplitudeFilter.cc @@ -0,0 +1,109 @@ +#include "CondFormats/EcalObjects/interface/EcalTPGGroups.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include +#include +#include +#include + +EcalFenixOddAmplitudeFilter::EcalFenixOddAmplitudeFilter(bool tpInfoPrintout) + : inputsAlreadyIn_(0), stripid_{0}, shift_(6), tpInfoPrintout_(tpInfoPrintout) {} + +EcalFenixOddAmplitudeFilter::~EcalFenixOddAmplitudeFilter() {} + +int EcalFenixOddAmplitudeFilter::setInput(int input) { + if (input > 0X3FFFF) { + edm::LogError("EcalTPG") << "ERROR IN INPUT OF ODD AMPLITUDE FILTER"; + return -1; + } + if (inputsAlreadyIn_ < 5) { + buffer_[inputsAlreadyIn_] = input; + inputsAlreadyIn_++; + } else { + for (int i = 0; i < 4; i++) { + buffer_[i] = buffer_[i + 1]; + } + buffer_[4] = input; + } + return 1; +} + +void EcalFenixOddAmplitudeFilter::process(std::vector &addout, std::vector &output) { + inputsAlreadyIn_ = 0; + for (unsigned int i = 0; i < 5; i++) { + buffer_[i] = 0; + } + + for (unsigned int i = 0; i < addout.size(); i++) { + // Only save TP info for Clock i >= 4 (from 0-9) because first 5 digis required to produce first ET value + if (i >= 4 && tpInfoPrintout_) { + std::cout << i << std::dec; + } + setInput(addout[i]); + process(); + output[i] = processedOutput_; + } + // shift the result by 1! + for (unsigned int i = 0; i < (output.size()); i++) { + if (i != output.size() - 1) { + output[i] = output[i + 1]; + } else { + output[i] = 0; + } + } + return; +} + +void EcalFenixOddAmplitudeFilter::process() { + processedOutput_ = 0; + if (inputsAlreadyIn_ < 5) + return; + int output = 0; + + for (int i = 0; i < 5; i++) { + output += (weights_[i] * buffer_[i]) >> shift_; + } + + if (output < 0) + output = 0; + if (output > 0X3FFFF) + output = 0X3FFFF; + processedOutput_ = output; + + if (tpInfoPrintout_) { + std::cout << " " << stripid_; + for (int i = 0; i < 5; i++) { + std::cout << " " << weights_[i] << std::dec; + } + for (int i = 0; i < 5; i++) { + std::cout << " " << weights_[i] / 64.0 << std::dec; + } + for (int i = 0; i < 5; i++) { + std::cout << " " << buffer_[i] << std::dec; + } // Digis + std::cout << " --> output: " << output; + std::cout << " ODD"; + std::cout << std::endl; + } +} + +void EcalFenixOddAmplitudeFilter::setParameters(uint32_t raw, + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap, + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup) { + stripid_ = raw; + uint32_t params_[5]; + const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgOddWeightGroup->getMap(); + EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(raw); + if (it != groupmap.end()) { + uint32_t weightid = (*it).second; + const EcalTPGOddWeightIdMap::EcalTPGWeightMap &weightmap = ecaltpgOddWeightMap->getMap(); + EcalTPGOddWeightIdMap::EcalTPGWeightMapItr itw = weightmap.find(weightid); + (*itw).second.getValues(params_[0], params_[1], params_[2], params_[3], params_[4]); + + for (int i = 0; i < 5; ++i) { + weights_[i] = (params_[i] & 0x40) ? (int)(params_[i] | 0xffffffc0) : (int)(params_[i]); + } + } else + edm::LogWarning("EcalTPG") << " could not find EcalTPGGroupsMap entry for " << raw; +} diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStrip.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStrip.cc index 32667292d7277..a55c64f9dead9 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStrip.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStrip.cc @@ -2,20 +2,29 @@ #include #include #include +#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" #include +#include +#include //------------------------------------------------------------------------------------- -EcalFenixStrip::EcalFenixStrip( - const EcalElectronicsMapping *theMapping, bool debug, bool famos, int maxNrSamples, int nbMaxXtals) - : theMapping_(theMapping), debug_(debug), famos_(famos), nbMaxXtals_(nbMaxXtals) { +EcalFenixStrip::EcalFenixStrip(const EcalElectronicsMapping *theMapping, + bool debug, + bool famos, + int maxNrSamples, + int nbMaxXtals, + bool tpInfoPrintout) + : theMapping_(theMapping), debug_(debug), famos_(famos), nbMaxXtals_(nbMaxXtals), tpInfoPrintout_(tpInfoPrintout) { linearizer_.resize(nbMaxXtals_); for (int i = 0; i < nbMaxXtals_; i++) linearizer_[i] = new EcalFenixLinearizer(famos_); adder_ = new EcalFenixEtStrip(); - amplitude_filter_ = new EcalFenixAmplitudeFilter(); + amplitude_filter_ = new EcalFenixAmplitudeFilter(tpInfoPrintout); + oddAmplitude_filter_ = new EcalFenixOddAmplitudeFilter(tpInfoPrintout); peak_finder_ = new EcalFenixPeakFinder(); fenixFormatterEB_ = new EcalFenixStripFormatEB(); fenixFormatterEE_ = new EcalFenixStripFormatEE(); @@ -28,8 +37,12 @@ EcalFenixStrip::EcalFenixStrip( for (int i = 0; i < 5; i++) lin_out_[i] = v; add_out_.resize(maxNrSamples); - filt_out_.resize(maxNrSamples); - peak_out_.resize(maxNrSamples); + + even_filt_out_.resize(maxNrSamples); + even_peak_out_.resize(maxNrSamples); + odd_filt_out_.resize(maxNrSamples); + odd_peak_out_.resize(maxNrSamples); + format_out_.resize(maxNrSamples); fgvb_out_.resize(maxNrSamples); fgvb_out_temp_.resize(maxNrSamples); @@ -41,12 +54,209 @@ EcalFenixStrip::~EcalFenixStrip() { delete linearizer_[i]; delete adder_; delete amplitude_filter_; + delete oddAmplitude_filter_; delete peak_finder_; delete fenixFormatterEB_; delete fenixFormatterEE_; delete fgvbEE_; } +void EcalFenixStrip::process(std::vector &samples, int nrXtals, std::vector &out) { + // now call processing + if (samples.empty()) { + edm::LogWarning("EcalTPG") << "Warning: 0 size vector found in EcalFenixStripProcess!!!!!"; + return; + } + const EcalTriggerElectronicsId elId = theMapping_->getTriggerElectronicsId(samples[0].id()); + uint32_t stripid = elId.rawId() & 0xfffffff8; // from Pascal + + identif_ = getFGVB()->getMissedStripFlag(); + + process_part1(identif_, + samples, + nrXtals, + stripid, + ecaltpPed_, + ecaltpLin_, + ecaltpgWeightMap_, + ecaltpgWeightGroup_, + ecaltpgOddWeightMap_, + ecaltpgOddWeightGroup_, + ecaltpgBadX_); // templated part + process_part2_barrel(stripid, ecaltpgSlidW_, + ecaltpgFgStripEE_); // part different for barrel/endcap + out = format_out_; +} + +void EcalFenixStrip::process(std::vector &samples, int nrXtals, std::vector &out) { + // now call processing + if (samples.empty()) { + std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl; + return; + } + const EcalTriggerElectronicsId elId = theMapping_->getTriggerElectronicsId(samples[0].id()); + uint32_t stripid = elId.rawId() & 0xfffffff8; // from Pascal + + identif_ = getFGVB()->getMissedStripFlag(); + + process_part1(identif_, + samples, + nrXtals, + stripid, + ecaltpPed_, + ecaltpLin_, + ecaltpgWeightMap_, + ecaltpgWeightGroup_, + ecaltpgOddWeightMap_, + ecaltpgOddWeightGroup_, + ecaltpgBadX_); // templated part + process_part2_endcap(stripid, ecaltpgSlidW_, ecaltpgFgStripEE_, ecaltpgStripStatus_); + out = format_out_; // FIXME: timing + return; +} + +/* +* strip level processing - part1. +* The linearizer and adder are run only once. +* Then the even and odd filters and peak finder are run looking at the TPmode flag +*/ +template +void EcalFenixStrip::process_part1(int identif, + std::vector &df, + int nrXtals, + uint32_t stripid, + const EcalTPGPedestals *ecaltpPed, + const EcalTPGLinearizationConst *ecaltpLin, + const EcalTPGWeightIdMap *ecaltpgWeightMap, + const EcalTPGWeightGroup *ecaltpgWeightGroup, + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap, + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup, + const EcalTPGCrystalStatus *ecaltpBadX) { + if (debug_) { + std::cout << "\n\nEcalFenixStrip input is a vector of size: " << nrXtals << std::endl; + std::cout << " " << std::endl; + std::cout << "ECAL TPG TPMode printout:" << std::endl; + ecaltpgTPMode_->print(std::cout); + } + + // loop over crystals + for (int cryst = 0; cryst < nrXtals; cryst++) { + if (debug_) { + std::cout << std::endl; + std::cout << "crystal " << cryst << " EBDataFrame/EEDataFrame is (ADC counts): " << std::endl; + for (int i = 0; i < df[cryst].size(); i++) { + std::cout << " " << std::dec << df[cryst][i].adc(); + } + std::cout << std::endl; + } + // call linearizer + this->getLinearizer(cryst)->setParameters(df[cryst].id().rawId(), ecaltpPed, ecaltpLin, ecaltpBadX); + this->getLinearizer(cryst)->process(df[cryst], lin_out_[cryst]); + } + + if (debug_) { + std::cout << "output of linearizer is a vector of size: " << std::dec << lin_out_.size() << " of which used " + << nrXtals << std::endl; + for (int ix = 0; ix < nrXtals; ix++) { + std::cout << "cryst: " << ix << " value : " << std::dec << std::endl; + std::cout << " lin_out[ix].size() = " << std::dec << lin_out_[ix].size() << std::endl; + for (unsigned int i = 0; i < lin_out_[ix].size(); i++) { + std::cout << " " << std::dec << (lin_out_[ix])[i]; + } + std::cout << std::endl; + } + std::cout << std::endl; + } + + // Now call the sFGVB - this is common between EB and EE! + getFGVB()->setParameters(identif, stripid, ecaltpgFgStripEE_); + getFGVB()->process(lin_out_, fgvb_out_temp_); + + if (debug_) { + std::cout << "output of strip fgvb is a vector of size: " << std::dec << fgvb_out_temp_.size() << std::endl; + for (unsigned int i = 0; i < fgvb_out_temp_.size(); i++) { + std::cout << " " << std::dec << (fgvb_out_temp_[i]); + } + std::cout << std::endl; + } + // call adder + this->getAdder()->process(lin_out_, nrXtals, add_out_); // add_out is of size SIZEMAX=maxNrSamples + + if (debug_) { + std::cout << "output of adder is a vector of size: " << std::dec << add_out_.size() << std::endl; + for (unsigned int ix = 0; ix < add_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << std::dec << add_out_[ix] << std::endl; + } + std::cout << std::endl; + } + + if (famos_) { + even_filt_out_[0] = add_out_[0]; + even_peak_out_[0] = add_out_[0]; + return; + } else { + // This is where the amplitude filters are called + // the TPmode flag will determine which are called and if the peak finder is called. + // Call even amplitude filter + this->getEvenFilter()->setParameters(stripid, ecaltpgWeightMap, ecaltpgWeightGroup); + this->getEvenFilter()->process(add_out_, even_filt_out_, fgvb_out_temp_, fgvb_out_); + + // Print out even filter ET and sfgvb values + if (debug_) { + std::cout << "output of EVEN filter is a vector of size: " << std::dec << even_filt_out_.size() << std::endl; + for (unsigned int ix = 0; ix < even_filt_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << std::dec << even_filt_out_[ix] << std::endl; + } + std::cout << std::endl; + std::cout << "output of EVEN sfgvb after filter is a vector of size: " << std::dec << fgvb_out_.size() + << std::endl; + for (unsigned int ix = 0; ix < fgvb_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << std::dec << fgvb_out_[ix] << std::endl; + } + std::cout << std::endl; + } + + // Call peak finder on even filter output + this->getPeakFinder()->process(even_filt_out_, even_peak_out_); + + // Print out even filter peak finder values + if (debug_) { + std::cout << "output of EVEN peakfinder is a vector of size: " << even_peak_out_.size() << std::endl; + for (unsigned int ix = 0; ix < even_peak_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << even_peak_out_[ix] << std::endl; + } + std::cout << std::endl; + } + + // Run the odd filter + this->getOddFilter()->setParameters(stripid, ecaltpgOddWeightMap, ecaltpgOddWeightGroup); + this->getOddFilter()->process(add_out_, odd_filt_out_); + + // Print out odd filter ET + if (debug_) { + std::cout << "output of ODD filter is a vector of size: " << std::dec << odd_filt_out_.size() << std::endl; + for (unsigned int ix = 0; ix < odd_filt_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << std::dec << odd_filt_out_[ix] << std::endl; + } + std::cout << std::endl; + } + + // And run the odd peak finder always (then the formatter will use the configuration to decide to use it or not) + // Call peak finder on even filter output + this->getPeakFinder()->process(odd_filt_out_, odd_peak_out_); + + if (debug_) { + std::cout << "output of ODD peakfinder is a vector of size: " << odd_peak_out_.size() << std::endl; + for (unsigned int ix = 0; ix < odd_peak_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << odd_peak_out_[ix] << std::endl; + } + std::cout << std::endl; + } + + return; + } +} + //---------------------------------------------------------------------------------- void EcalFenixStrip::process_part2_barrel(uint32_t stripid, const EcalTPGSlidingWindow *ecaltpgSlidW, @@ -56,14 +266,15 @@ void EcalFenixStrip::process_part2_barrel(uint32_t stripid, // this->getFGVB()->process(lin_out_,fgvb_out_); // call formatter - this->getFormatterEB()->setParameters(stripid, ecaltpgSlidW); - this->getFormatterEB()->process(fgvb_out_, peak_out_, filt_out_, format_out_); - // this is a test: + this->getFormatterEB()->setParameters(stripid, ecaltpgSlidW, ecaltpgTPMode_); + this->getFormatterEB()->process(fgvb_out_, even_peak_out_, even_filt_out_, odd_peak_out_, odd_filt_out_, format_out_); + if (debug_) { - std::cout << "output of formatter is a vector of size: " << format_out_.size() << std::endl; + std::cout << "output of strip EB formatter is a vector of size: " << format_out_.size() << std::endl; std::cout << "value : " << std::endl; - for (unsigned int i = 0; i < format_out_.size(); i++) { - std::cout << " " << format_out_[i]; + for (unsigned int ix = 0; ix < format_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << format_out_[ix] << " 0b" + << std::bitset<14>(format_out_[ix]).to_string() << std::endl; } std::cout << std::endl; } @@ -79,16 +290,15 @@ void EcalFenixStrip::process_part2_endcap(uint32_t stripid, // this->getFGVB()->process(lin_out_,fgvb_out_); // call formatter - this->getFormatterEE()->setParameters(stripid, ecaltpgSlidW, ecaltpgStripStatus); - - this->getFormatterEE()->process(fgvb_out_, peak_out_, filt_out_, format_out_); + this->getFormatterEE()->setParameters(stripid, ecaltpgSlidW, ecaltpgStripStatus, ecaltpgTPMode_); + this->getFormatterEE()->process(fgvb_out_, even_peak_out_, even_filt_out_, odd_peak_out_, odd_filt_out_, format_out_); - // this is a test: if (debug_) { - std::cout << "output of formatter is a vector of size: " << format_out_.size() << std::endl; + std::cout << "output of strip EE formatter is a vector of size: " << format_out_.size() << std::endl; std::cout << "value : " << std::endl; - for (unsigned int i = 0; i < format_out_.size(); i++) { - std::cout << " " << std::dec << format_out_[i]; + for (unsigned int ix = 0; ix < format_out_.size(); ix++) { + std::cout << "Clock: " << ix << " value : " << format_out_[ix] << " 0b" + << std::bitset<14>(format_out_[ix]).to_string() << std::endl; } std::cout << std::endl; } diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEB.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEB.cc index e8bc3698b2f72..15c541dcea5a7 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEB.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEB.cc @@ -1,50 +1,108 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include +#include #include EcalFenixStripFormatEB::EcalFenixStripFormatEB() : shift_(0) {} EcalFenixStripFormatEB::~EcalFenixStripFormatEB() {} -int EcalFenixStripFormatEB::setInput(int input, int inputPeak, int inputsFGVB) { +int EcalFenixStripFormatEB::setInput( + int input_even, int inputEvenPeak, int input_odd, int inputOddPeak, int inputsFGVB) { inputsFGVB_ = inputsFGVB; - inputPeak_ = inputPeak; - input_ = input; + inputEvenPeak_ = inputEvenPeak; + input_even_ = input_even; + inputOddPeak_ = inputOddPeak; + input_odd_ = input_odd; return 0; } int EcalFenixStripFormatEB::process() { - // buffer_=input_>>shift_; //FIXME: buffer why? + int even_output = 0; + int odd_output = 0; + + if (ecaltpgTPMode_->DisableEBEvenPeakFinder) { + even_output = input_even_ >> shift_; + } else { + if (inputEvenPeak_ == 1) + even_output = input_even_ >> shift_; + } + + if (ecaltpgTPMode_->EnableEBOddPeakFinder) { + if (inputOddPeak_ == 1) + odd_output = input_odd_ >> shift_; + } else { + odd_output = input_odd_ >> shift_; + } + + // Prepare the amplitude output for the strip looking at the TPmode options + int output = 0; + bool is_odd_larger = false; + if (ecaltpgTPMode_->EnableEBOddFilter && odd_output > even_output) + is_odd_larger = + true; // If running with odd filter enabled, check if odd output is larger regardless of strip formatter output mode + switch (ecaltpgTPMode_->FenixEBStripOutput) { + case 0: // even filter out + output = even_output; + break; + case 1: // odd filter out + if (ecaltpgTPMode_->EnableEBOddFilter) + output = odd_output; + else + output = even_output; + break; + case 2: // larger between odd and even + if (ecaltpgTPMode_->EnableEBOddFilter && odd_output > even_output) { + output = odd_output; + } else + output = even_output; + break; + case 3: // even + odd + if (ecaltpgTPMode_->EnableEBOddFilter) + output = even_output + odd_output; + else + output = even_output; + break; + } - if (inputPeak_ == 0) - return ((inputsFGVB_ & 0x1) << 12); - // int output=buffer_; - int output = input_ >> shift_; if (output > 0XFFF) output = 0XFFF; // ok: barrel saturates at 12 bits - // Add stripFGVB + + // Info bits + // bit12 is sFGVB, bit13 is for odd>even flagging output |= ((inputsFGVB_ & 0x1) << 12); + // if the flagging mode is OFF the bit stays 0, since it is not used for other things + if (ecaltpgTPMode_->EnableEBOddFilter && ecaltpgTPMode_->FenixEBStripInfobit2) { + output |= ((is_odd_larger & 0x1) << 13); + } + return output; } void EcalFenixStripFormatEB::process(std::vector &sFGVBout, - std::vector &peakout, - std::vector &filtout, + std::vector &peakout_even, + std::vector &filtout_even, + std::vector &peakout_odd, + std::vector &filtout_odd, std::vector &output) { - if (peakout.size() != filtout.size() || sFGVBout.size() != filtout.size()) { + if (peakout_even.size() != filtout_even.size() || sFGVBout.size() != filtout_even.size() || + peakout_odd.size() != filtout_odd.size() || filtout_odd.size() != filtout_even.size()) { edm::LogWarning("EcalTPG") << " problem in EcalFenixStripFormatEB: sfgvb_out, peak_out and " "filt_out don't have the same size"; } - for (unsigned int i = 0; i < filtout.size(); i++) { - setInput(filtout[i], peakout[i], sFGVBout[i]); - + for (unsigned int i = 0; i < filtout_even.size(); i++) { + setInput(filtout_even[i], peakout_even[i], filtout_odd[i], peakout_odd[i], sFGVBout[i]); output[i] = process(); } return; } -void EcalFenixStripFormatEB::setParameters(uint32_t &id, const EcalTPGSlidingWindow *&slWin) { +void EcalFenixStripFormatEB::setParameters(uint32_t &id, + const EcalTPGSlidingWindow *&slWin, + const EcalTPGTPMode *ecaltptTPMode) { + // TP mode contains options for the formatter (odd/even filters config) + ecaltpgTPMode_ = ecaltptTPMode; const EcalTPGSlidingWindowMap &slwinmap = slWin->getMap(); EcalTPGSlidingWindowMapIterator it = slwinmap.find(id); if (it != slwinmap.end()) diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEE.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEE.cc index d9520aad7f278..4aa9ba95a14f8 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEE.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEE.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -13,9 +14,11 @@ EcalFenixStripFormatEE::~EcalFenixStripFormatEE() {} //----------------------------------------------------------------------------------------- -int EcalFenixStripFormatEE::setInput(int input, int inputPeak, int fgvb) { - inputPeak_ = inputPeak; - input_ = input; +int EcalFenixStripFormatEE::setInput(int input_even, int inputEvenPeak, int input_odd, int inputOddPeak, int fgvb) { + inputEvenPeak_ = inputEvenPeak; + input_even_ = input_even; + inputOddPeak_ = inputOddPeak; + input_odd_ = input_odd; fgvb_ = fgvb; return 0; } @@ -26,33 +29,87 @@ int EcalFenixStripFormatEE::process() { if (stripStatus_ != 0) return 0; - // Peak not found - only return fgvb - if (inputPeak_ == 0) - return ((fgvb_ & 0x1) << 12); + int even_output = 0; + int odd_output = 0; - int output = input_ >> shift_; + if (ecaltpgTPMode_->DisableEEEvenPeakFinder) { + even_output = input_even_ >> shift_; + } else { + if (inputEvenPeak_ == 1) + even_output = input_even_ >> shift_; + } + + if (ecaltpgTPMode_->EnableEEOddPeakFinder) { + if (inputOddPeak_ == 1) + odd_output = input_odd_ >> shift_; + } else { + odd_output = input_odd_ >> shift_; + } + + // Prepare the amplitude output for the strip looking at the TPmode options + int output = 0; + bool is_odd_larger = false; + + if (ecaltpgTPMode_->EnableEEOddFilter && (odd_output > even_output)) + is_odd_larger = + true; // If running with odd filter enabled, check if odd output is larger regardless of strip formatter output mode + switch (ecaltpgTPMode_->FenixEEStripOutput) { + case 0: // even filter out + output = even_output; + break; + case 1: // odd filter out + if (ecaltpgTPMode_->EnableEEOddFilter) + output = odd_output; + else + output = even_output; + break; + case 2: // larger between odd and even + if (ecaltpgTPMode_->EnableEEOddFilter && (odd_output > even_output)) { + output = odd_output; + } else + output = even_output; + break; + case 3: // even + odd + if (ecaltpgTPMode_->EnableEEOddFilter) + output = even_output + odd_output; + else + output = even_output; + break; + } // barrel saturates at 12 bits, endcap at 10! // Pascal: finally no,endcap has 12 bits as in EB (bug in FENIX!!!!) if (output > 0XFFF) output = 0XFFF; - output = output | ((fgvb_ & 0x1) << 12); // Pascal (was 10) + + // Info bits + // bit12 is sFGVB, bit13 is for odd>even flagging + output |= ((fgvb_ & 0x1) << 12); + + if (ecaltpgTPMode_->EnableEEOddFilter && ecaltpgTPMode_->FenixEEStripInfobit2) { + output |= ((is_odd_larger & 0x1) << 13); + } return output; } //------------------------------------------------------------------------------------------ void EcalFenixStripFormatEE::process(std::vector &fgvbout, - std::vector &peakout, - std::vector &filtout, + std::vector &peakout_even, + std::vector &filtout_even, + std::vector &peakout_odd, + std::vector &filtout_odd, std::vector &output) { - if (peakout.size() != filtout.size()) { + if (peakout_even.size() != filtout_even.size() || fgvbout.size() != filtout_even.size() || + peakout_odd.size() != filtout_odd.size() || filtout_odd.size() != filtout_even.size()) { edm::LogWarning("EcalTPG") << " problem in EcalFenixStripFormatEE: peak_out and filt_out don't " "have the same size"; - std::cout << " Size peak_out" << peakout.size() << ", size filt_out:" << filtout.size() << std::flush << std::endl; + std::cout << " Size peak_out" << peakout_even.size() << ", size filt_out:" << filtout_even.size() << std::flush + << std::endl; } - for (unsigned int i = 0; i < filtout.size(); i++) { - setInput(filtout[i], peakout[i], fgvbout[i]); + + for (unsigned int i = 0; i < filtout_even.size(); i++) { + setInput(filtout_even[i], peakout_even[i], filtout_odd[i], peakout_odd[i], fgvbout[i]); output[i] = process(); } return; @@ -61,7 +118,10 @@ void EcalFenixStripFormatEE::process(std::vector &fgvbout, void EcalFenixStripFormatEE::setParameters(uint32_t id, const EcalTPGSlidingWindow *&slWin, - const EcalTPGStripStatus *stripStatus) { + const EcalTPGStripStatus *stripStatus, + const EcalTPGTPMode *ecaltpgTPMode) { + // TP mode contains options for the formatter (odd/even filters config) + ecaltpgTPMode_ = ecaltpgTPMode; const EcalTPGSlidingWindowMap &slwinmap = slWin->getMap(); EcalTPGSlidingWindowMapIterator it = slwinmap.find(id); if (it != slwinmap.end()) diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcp.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcp.cc index 7a3f1d82d2c86..2d011183013c5 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcp.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcp.cc @@ -1,24 +1,26 @@ #include -#include #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h" #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h" #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h" #include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" #include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" +#include #include "FWCore/Framework/interface/ESHandle.h" #include //---------------------------------------------------------------------------------------- -EcalFenixTcp::EcalFenixTcp(bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips) - : debug_(debug), nbMaxStrips_(nbMaxStrips) { +EcalFenixTcp::EcalFenixTcp( + bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips, bool tpInfoPrintout) + : debug_(debug), nbMaxStrips_(nbMaxStrips), tpInfoPrintout_(tpInfoPrintout) { bypasslin_.resize(nbMaxStrips_); for (int i = 0; i < nbMaxStrips_; i++) bypasslin_[i] = new EcalFenixBypassLin(); adder_ = new EcalFenixEtTot(); maxOf2_ = new EcalFenixMaxof2(maxNrSamples, nbMaxStrips_); - formatter_ = new EcalFenixTcpFormat(tcpFormat, debug_, famos, binOfMax); + formatter_EB_ = new EcalFenixTcpFormatEB(tcpFormat, debug_, famos, binOfMax); + formatter_EE_ = new EcalFenixTcpFormatEE(tcpFormat, debug_, famos, binOfMax); fgvbEB_ = new EcalFenixFgvbEB(maxNrSamples); fgvbEE_ = new EcalFenixTcpFgvbEE(maxNrSamples); sfgvbEB_ = new EcalFenixTcpsFgvbEB(); @@ -28,7 +30,9 @@ EcalFenixTcp::EcalFenixTcp(bool tcpFormat, bool debug, bool famos, int binOfMax, std::vector vec(maxNrSamples, 0); for (int i = 0; i < nbMaxStrips_; i++) bypasslin_out_[i] = vec; - adder_out_.resize(maxNrSamples); + + adder_even_out_.resize(maxNrSamples); + adder_odd_out_.resize(maxNrSamples); maxOf2_out_.resize(maxNrSamples); fgvb_out_.resize(maxNrSamples); strip_fgvb_out_.resize(maxNrSamples); @@ -39,7 +43,8 @@ EcalFenixTcp::~EcalFenixTcp() { delete bypasslin_[i]; delete adder_; delete maxOf2_; - delete formatter_; + delete formatter_EB_; + delete formatter_EE_; delete fgvbEB_; delete fgvbEE_; } @@ -53,11 +58,14 @@ void EcalFenixTcp::process(std::vector &bid, // dummy argument for bool isInInnerRing, EcalTrigTowerDetId towid) { int bitMask = 12; - process_part1(tpframetow, nStr, bitMask); + // The 14th bit is always used for the odd>even flag. If the flagging is off in the Strip fenix the feature will be not used. + int bitOddEven = 13; + process_part1(tpframetow, nStr, bitMask, bitOddEven); process_part2_barrel(tpframetow, nStr, bitMask, + bitOddEven, ecaltpgFgEBGroup_, ecaltpgLutGroup_, ecaltpgLut_, @@ -78,12 +86,15 @@ void EcalFenixTcp::process(std::vector &bid, // dummy argument for bool isInInnerRing, EcalTrigTowerDetId towid) { int bitMask = 12; // Pascal: endcap has 12 bits as in EB (bug in FENIX!!!!) - // {was 10 before] - process_part1(tpframetow, nStr, bitMask); + // The 14th bit is always used for the odd>even flag. If the flagging is off in the Strip fenix the feature will be not used. + int bitOddEven = 13; + + process_part1(tpframetow, nStr, bitMask, bitOddEven); process_part2_endcap(tpframetow, nStr, bitMask, + bitOddEven, ecaltpgLutGroup_, ecaltpgLut_, ecaltpgFineGrainTowerEE_, @@ -94,42 +105,31 @@ void EcalFenixTcp::process(std::vector &bid, // dummy argument for towid); } //----------------------------------------------------------------------------------------- -void EcalFenixTcp::process_part1(std::vector> &tpframetow, int nStr, int bitMask) { - // //call bypasslin - // for (int istrip=0;istripgetBypasslin(istrip)->process(tpframetow[istrip],bypasslin_out_[istrip]); - // } - // //this is a test - // if (debug_) { - // std::cout<<"bypasslinout = "< stripin= bypasslin_out_[istrip]; - // for (unsigned int is=0;is> &tpframetow, int nStr, int bitMask, int bitOddEven) { // //call adder // this->getAdder()->process(bypasslin_out_, nStr, bitMask,adder_out_); - this->getAdder()->process(tpframetow, nStr, bitMask, adder_out_); + this->getAdder()->process(tpframetow, nStr, bitMask, bitOddEven, adder_even_out_, adder_odd_out_); // this is a test: if (debug_) { - std::cout << "output of adder is a vector of size: " << adder_out_.size() << std::endl; - std::cout << "value : " << std::endl; - for (unsigned int i = 0; i < adder_out_.size(); i++) { - std::cout << " " << adder_out_[i]; + std::cout << "output of TCP adder is a vector of size: " << adder_even_out_.size() << std::endl; + std::cout << "even sum : " << std::endl; + for (unsigned int i = 0; i < adder_even_out_.size(); i++) { + std::cout << " " << adder_even_out_[i]; + } + std::cout << std::endl; + std::cout << "odd sum : " << std::endl; + for (unsigned int i = 0; i < adder_odd_out_.size(); i++) { + std::cout << " " << adder_odd_out_[i]; } std::cout << std::endl; } - // return adder_out; return; } //----------------------------------------------------------------------------------------- void EcalFenixTcp::process_part2_barrel(std::vector> &bypasslinout, int nStr, int bitMask, + int bitOddEven, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, @@ -140,9 +140,10 @@ void EcalFenixTcp::process_part2_barrel(std::vector> &bypasslin std::vector &tcp_outTcc, EcalTrigTowerDetId towid) { // call maxof2 - // this->getMaxOf2()->process(bypasslin_out_,nStr,maxOf2_out_); - this->getMaxOf2()->process(bypasslinout, nStr, bitMask, maxOf2_out_); - // this is a test: + // this->getMaxOf2()->process(bypasslin_out_,nStr,maxOf2_out_); + // the oddEven flag is used to exclude "odd" strip from the computation of the maxof2 as in the fenix firmware + this->getMaxOf2()->process(bypasslinout, nStr, bitMask, bitOddEven, maxOf2_out_); + if (debug_) { std::cout << "output of maxof2 is a vector of size: " << maxOf2_out_.size() << std::endl; std::cout << "value : " << std::endl; @@ -153,9 +154,9 @@ void EcalFenixTcp::process_part2_barrel(std::vector> &bypasslin } // call fgvb - this->getFGVBEB()->setParameters(towid.rawId(), ecaltpgFgEBGroup, ecaltpgFineGrainEB); - this->getFGVBEB()->process(adder_out_, maxOf2_out_, fgvb_out_); + // The FGVB is computed only on the even sum, as in the firmware + this->getFGVBEB()->process(adder_even_out_, maxOf2_out_, fgvb_out_); // Call sFGVB this->getsFGVBEB()->process(bypasslinout, nStr, bitMask, strip_fgvb_out_); @@ -173,14 +174,22 @@ void EcalFenixTcp::process_part2_barrel(std::vector> &bypasslin // call formatter int eTTotShift = 2; - this->getFormatter()->setParameters(towid.rawId(), ecaltpgLutGroup, ecaltpgLut, ecaltpgBadTT, ecaltpgSpike); - this->getFormatter()->process(adder_out_, fgvb_out_, strip_fgvb_out_, eTTotShift, tcp_out, tcp_outTcc, false); - // this is a test: + this->getFormatterEB()->setParameters( + towid.rawId(), ecaltpgLutGroup, ecaltpgLut, ecaltpgBadTT, ecaltpgSpike, ecaltpgTPMode_); + this->getFormatterEB()->process( + adder_even_out_, adder_odd_out_, fgvb_out_, strip_fgvb_out_, eTTotShift, tcp_out, tcp_outTcc); + + if (tpInfoPrintout_) { + for (unsigned int i = 3; i < tcp_out.size(); i++) { + std::cout << " " << i << " " << std::dec << tcp_out[i] << std::endl; + } + } + if (debug_) { std::cout << "output of TCP formatter Barrel is a vector of size: " << std::dec << tcp_out.size() << std::endl; std::cout << "value : " << std::endl; for (unsigned int i = 0; i < tcp_out.size(); i++) { - std::cout << " " << i << " " << std::dec << tcp_out[i]; + std::cout << " " << i << " " << std::dec << tcp_out[i] << std::endl; } std::cout << std::endl; } @@ -191,6 +200,7 @@ void EcalFenixTcp::process_part2_barrel(std::vector> &bypasslin void EcalFenixTcp::process_part2_endcap(std::vector> &bypasslinout, int nStr, int bitMask, + int bitOddEven, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, @@ -215,10 +225,13 @@ void EcalFenixTcp::process_part2_endcap(std::vector> &bypasslin int eTTotShift = 2; // Pascal: endcap has 12 bits as in EB (bug in FENIX!!!!) // so shift must be applied to just keep [11:2] - this->getFormatter()->setParameters(towid.rawId(), ecaltpgLutGroup, ecaltpgLut, ecaltpgbadTT, nullptr); + this->getFormatterEE()->setParameters( + towid.rawId(), ecaltpgLutGroup, ecaltpgLut, ecaltpgbadTT, nullptr, ecaltpgTPMode_); - this->getFormatter()->process( - adder_out_, fgvb_out_, strip_fgvb_out_, eTTotShift, tcp_out, tcp_outTcc, isInInnerRings); + // Pass both the even and the odd Et sums to the EE formatter also if there is not TCP in the electronics. + // The feature can be implemented in the TCC in the future: the emulator is kept generic. + this->getFormatterEE()->process( + adder_even_out_, adder_odd_out_, fgvb_out_, strip_fgvb_out_, eTTotShift, tcp_out, tcp_outTcc, isInInnerRings); // this is a test: if (debug_) { std::cout << "output of TCP formatter(endcap) is a vector of size: " << std::dec << tcp_out.size() << std::endl; diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormat.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEB.cc similarity index 55% rename from SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormat.cc rename to SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEB.cc index 64964ad26f0f6..168eb8ed948a1 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormat.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEB.cc @@ -2,40 +2,38 @@ #include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" #include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include +#include #include - using namespace std; -EcalFenixTcpFormat::EcalFenixTcpFormat(bool tcpFormat, bool debug, bool famos, int binOfMax) +EcalFenixTcpFormatEB::EcalFenixTcpFormatEB(bool tcpFormat, bool debug, bool famos, int binOfMax) : tcpFormat_(tcpFormat), debug_(debug), famos_(famos), binOfMax_(binOfMax) { status_ = 0; badTTStatus_ = &status_; } -EcalFenixTcpFormat::~EcalFenixTcpFormat() {} +EcalFenixTcpFormatEB::~EcalFenixTcpFormatEB() {} -void EcalFenixTcpFormat::process(std::vector &Et, - std::vector &fgvb, - std::vector &sfgvb, - int eTTotShift, - std::vector &out, - std::vector &out2, - bool isInInnerRings) { +void EcalFenixTcpFormatEB::process(std::vector &Et_even_sum, + std::vector &Et_odd_sum, + std::vector &fgvb, + std::vector &sfgvb, + int eTTotShift, + std::vector &out, + std::vector &out2) { // put TP-s in the output // on request also in TcpFormat // for famos version we have to write dummies except for the middle - int myEt; + int myEt = 0; if (famos_) { for (unsigned int i = 0; i < out.size(); ++i) { if (i == binOfMax_ - 1) { - myEt = Et[0] >> eTTotShift; + myEt = Et_even_sum[i] >> eTTotShift; if (myEt > 0x3ff) myEt = 0x3ff; - if (isInInnerRings) - myEt = myEt / 2; // badTTStatus_ ==0 if the TT works // badTTStatus_ !=0 if there are some problems @@ -52,24 +50,48 @@ void EcalFenixTcpFormat::process(std::vector &Et, out[i] = EcalTriggerPrimitiveSample(); } } else { - for (unsigned int i = 0; i < Et.size(); ++i) { + for (unsigned int i = 0; i < Et_even_sum.size(); ++i) { int myFgvb = fgvb[i]; int mysFgvb = sfgvb[i]; - // myEt=Et[i]>>eTTotShift; - // if (myEt>0x3ff) myEt=0x3ff ; - // if (isInInnerRings) myEt = myEt /2 ; + bool is_odd_larger = false; + + // Check if odd sum is larger than even sum, in case flag_EB_odd_even_tcp is used + if (Et_odd_sum[i] > Et_even_sum[i]) { + is_odd_larger = true; + } + + switch (ecaltpgTPMode_->EBFenixTcpOutput) { + case 0: //output even sum + myEt = Et_even_sum[i]; + break; + case 1: // output larger of odd and even + if (Et_odd_sum[i] > Et_even_sum[i]) { + myEt = Et_odd_sum[i]; + } else { + myEt = Et_even_sum[i]; + } + break; + case 2: // output even+odd + myEt = Et_even_sum[i] + Et_odd_sum[i]; + break; + default: + // In case of unknown configuration switch to default + myEt = Et_even_sum[i]; + break; + } + + // check TPmode config to decide to output the FGVB or the odd>even flag + int infobit1 = myFgvb; + if (ecaltpgTPMode_->EBFenixTcpInfobit1) + infobit1 = is_odd_larger; - // bug fix 091009: - myEt = Et[i]; if (myEt > 0xfff) myEt = 0xfff; - if (isInInnerRings) - myEt = myEt / 2; myEt >>= eTTotShift; if (myEt > 0x3ff) myEt = 0x3ff; - // Spike killing + // Spike killer if ((myEt > spikeZeroThresh_) && (mysFgvb == 0)) { myEt = 0; } @@ -82,19 +104,20 @@ void EcalFenixTcpFormat::process(std::vector &Et, int ttFlag = (lut_out & 0x700) >> 8; if (tcpFormat_) { - out2[i] = EcalTriggerPrimitiveSample(((ttFlag & 0x7) << 11) | ((myFgvb & 0x1) << 10) | (myEt & 0x3ff)); + out2[i] = EcalTriggerPrimitiveSample(((ttFlag & 0x7) << 11) | ((infobit1 & 0x1) << 10) | (myEt & 0x3ff)); } myEt = lut_out & 0xff; - out[i] = EcalTriggerPrimitiveSample(myEt, myFgvb, mysFgvb, ttFlag); + out[i] = EcalTriggerPrimitiveSample(myEt, infobit1, mysFgvb, ttFlag); } } } -void EcalFenixTcpFormat::setParameters(uint32_t towid, - const EcalTPGLutGroup *ecaltpgLutGroup, - const EcalTPGLutIdMap *ecaltpgLut, - const EcalTPGTowerStatus *ecaltpgbadTT, - const EcalTPGSpike *ecaltpgSpike) { +void EcalFenixTcpFormatEB::setParameters(uint32_t towid, + const EcalTPGLutGroup *ecaltpgLutGroup, + const EcalTPGLutIdMap *ecaltpgLut, + const EcalTPGTowerStatus *ecaltpgbadTT, + const EcalTPGSpike *ecaltpgSpike, + const EcalTPGTPMode *ecaltpgTPMode) { // Get TP zeroing threshold - defaut to 1023 for old data (no record found or // EE) spikeZeroThresh_ = 1023; @@ -125,4 +148,6 @@ void EcalFenixTcpFormat::setParameters(uint32_t towid, if (itbadTT != badTTMap.end()) { badTTStatus_ = &(*itbadTT).second; } + + ecaltpgTPMode_ = ecaltpgTPMode; } diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEE.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEE.cc new file mode 100644 index 0000000000000..810fc5352bcf7 --- /dev/null +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixTcpFormatEE.cc @@ -0,0 +1,158 @@ +#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include + +using namespace std; + +EcalFenixTcpFormatEE::EcalFenixTcpFormatEE(bool tcpFormat, bool debug, bool famos, int binOfMax) + : tcpFormat_(tcpFormat), debug_(debug), famos_(famos), binOfMax_(binOfMax) { + status_ = 0; + badTTStatus_ = &status_; +} + +EcalFenixTcpFormatEE::~EcalFenixTcpFormatEE() {} + +void EcalFenixTcpFormatEE::process(std::vector &Et_even_sum, + std::vector &Et_odd_sum, + std::vector &fgvb, + std::vector &sfgvb, + int eTTotShift, + std::vector &out, + std::vector &out2, + bool isInInnerRings) { + // put TP-s in the output + // on request also in TcpFormat + // for famos version we have to write dummies except for the middle + + int myEt; + if (famos_) { + for (unsigned int i = 0; i < out.size(); ++i) { + if (i == binOfMax_ - 1) { + myEt = Et_even_sum[i] >> eTTotShift; + if (isInInnerRings && (myEt <= 0xfff)) + myEt = myEt / 2; + if (myEt > 0xfff) + myEt = 0xfff; + + // badTTStatus_ ==0 if the TT works + // badTTStatus_ !=0 if there are some problems + int lut_out; + if (*badTTStatus_ != 0) { + lut_out = 0; + } else + lut_out = (lut_)[myEt]; + + int ttFlag = (lut_out & 0x700) >> 8; + myEt = lut_out & 0xff; + out[i] = EcalTriggerPrimitiveSample(myEt, fgvb[0], sfgvb[0], ttFlag); + } else + out[i] = EcalTriggerPrimitiveSample(); + } + } else { + for (unsigned int i = 0; i < Et_even_sum.size(); ++i) { + int myFgvb = fgvb[i]; + int mysFgvb = sfgvb[i]; + bool is_odd_larger = false; + + // Check if odd sum is larger than even sum, in case flag_EE_odd_even_tcp is used + if (Et_odd_sum[i] > Et_even_sum[i]) { + is_odd_larger = true; + } + + switch (ecaltpgTPMode_->EEFenixTcpOutput) { + case 0: //output even sum + myEt = Et_even_sum[i]; + break; + case 1: // output larger of odd and even + if (Et_odd_sum[i] > Et_even_sum[i]) { + myEt = Et_odd_sum[i]; + } else { + myEt = Et_even_sum[i]; + } + break; + case 2: // output even+odd + myEt = Et_even_sum[i] + Et_odd_sum[i]; + break; + default: + // In case of unknown configuration switch to default + myEt = Et_even_sum[i]; + break; + } + + // check TPmode config to decide to output the FGVB or the odd>even flag + int infobit1 = myFgvb; + if (ecaltpgTPMode_->EEFenixTcpInfobit1) + infobit1 = is_odd_larger; + + if (isInInnerRings && (myEt <= 0xfff)) + myEt = myEt / 2; + if (myEt > 0xfff) + myEt = 0xfff; + myEt >>= eTTotShift; + if (myEt > 0x3ff) + myEt = 0x3ff; + + // Spike killing + if ((myEt > spikeZeroThresh_) && (mysFgvb == 0)) { + myEt = 0; + } + + int lut_out; + if (*badTTStatus_ != 0) { + lut_out = 0; + } else + lut_out = (lut_)[myEt]; + + int ttFlag = (lut_out & 0x700) >> 8; + if (tcpFormat_) { + out2[i] = EcalTriggerPrimitiveSample(((ttFlag & 0x7) << 11) | ((infobit1 & 0x1) << 10) | (myEt & 0x3ff)); + } + myEt = lut_out & 0xff; + out[i] = EcalTriggerPrimitiveSample(myEt, infobit1, mysFgvb, ttFlag); + } + } +} + +void EcalFenixTcpFormatEE::setParameters(uint32_t towid, + const EcalTPGLutGroup *ecaltpgLutGroup, + const EcalTPGLutIdMap *ecaltpgLut, + const EcalTPGTowerStatus *ecaltpgbadTT, + const EcalTPGSpike *ecaltpgSpike, + const EcalTPGTPMode *ecaltpgTPMode) { + // Get TP zeroing threshold - defaut to 1023 for old data (no record found or + // EE) + spikeZeroThresh_ = 1023; + if (ecaltpgSpike != nullptr) { + const EcalTPGSpike::EcalTPGSpikeMap &spikeMap = ecaltpgSpike->getMap(); + EcalTPGSpike::EcalTPGSpikeMapIterator sit = spikeMap.find(towid); + if (sit != spikeMap.end()) { + spikeZeroThresh_ = sit->second; + } + } + + const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgLutGroup->getMap(); + EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(towid); + if (it != groupmap.end()) { + uint32_t lutid = (*it).second; + const EcalTPGLutIdMap::EcalTPGLutMap &lutmap = ecaltpgLut->getMap(); + EcalTPGLutIdMap::EcalTPGLutMapItr itl = lutmap.find(lutid); + if (itl != lutmap.end()) { + lut_ = (*itl).second.getLut(); + } else + edm::LogWarning("EcalTPG") << " could not find EcalTPGLutMap for " << lutid; + + } else + edm::LogWarning("EcalTPG") << " could not find EcalTPGFineGrainTowerEEMap for " << towid; + + const EcalTPGTowerStatusMap &badTTMap = ecaltpgbadTT->getMap(); + EcalTPGTowerStatusMapIterator itbadTT = badTTMap.find(towid); + if (itbadTT != badTTMap.end()) { + badTTStatus_ = &(*itbadTT).second; + } + + ecaltpgTPMode_ = ecaltpgTPMode; +} diff --git a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalTrigPrimFunctionalAlgo.cc b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalTrigPrimFunctionalAlgo.cc index 9877047d07e43..5c9acd2384d26 100644 --- a/SimCalorimetry/EcalTrigPrimAlgos/src/EcalTrigPrimFunctionalAlgo.cc +++ b/SimCalorimetry/EcalTrigPrimAlgos/src/EcalTrigPrimFunctionalAlgo.cc @@ -1,11 +1,11 @@ /** \class EcalTrigPrimFunctionalAlgo * * EcalTrigPrimFunctionalAlgo is the main algorithm class for TPG - * It coordinates all the aother algorithms + * It coordinates all the other algorithms * Structure is very close to electronics * * - * \author Ursula Berthon, Stephanie Baffioni, LLR Palaiseau + * \author Ursula Berthon, Stephanie Baffioni, LLR Palaiseau * * \version 1st Version may 2006 * \version 2nd Version jul 2006 @@ -38,8 +38,7 @@ #include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" #include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" -#include -#include +#include const unsigned int EcalTrigPrimFunctionalAlgo::nrSamples_ = 5; // to be written const unsigned int EcalTrigPrimFunctionalAlgo::maxNrSamplesOut_ = 10; @@ -54,7 +53,8 @@ EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo(const EcalTrigTowerConsti int binofmax, bool tcpFormat, bool debug, - bool famos) + bool famos, + bool tpInfoPrintout) : eTTmap_(eTTmap), theEndcapGeometry_(endcapGeometry), theMapping_(theMapping), @@ -62,7 +62,8 @@ EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo(const EcalTrigTowerConsti tcpFormat_(tcpFormat), barrelOnly_(true), debug_(debug), - famos_(famos) + famos_(famos), + tpInfoPrintout_(tpInfoPrintout) { if (famos_) @@ -73,13 +74,14 @@ EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo(const EcalTrigTowerConsti } EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo( - const EcalElectronicsMapping *theMapping, int binofmax, bool tcpFormat, bool debug, bool famos) + const EcalElectronicsMapping *theMapping, int binofmax, bool tcpFormat, bool debug, bool famos, bool tpInfoPrintout) : theMapping_(theMapping), binOfMaximum_(binofmax), tcpFormat_(tcpFormat), barrelOnly_(true), debug_(debug), - famos_(famos) + famos_(famos), + tpInfoPrintout_(tpInfoPrintout) { if (famos_) @@ -92,8 +94,9 @@ EcalTrigPrimFunctionalAlgo::EcalTrigPrimFunctionalAlgo( //---------------------------------------------------------------------- void EcalTrigPrimFunctionalAlgo::init() { // create main sub algos - estrip_ = std::make_unique(theMapping_, debug_, famos_, maxNrSamples_, nbMaxXtals_); - etcp_ = std::make_unique(tcpFormat_, debug_, famos_, binOfMaximum_, maxNrSamples_, nbMaxStrips_); + estrip_ = std::make_unique(theMapping_, debug_, famos_, maxNrSamples_, nbMaxXtals_, tpInfoPrintout_); + etcp_ = std::make_unique( + tcpFormat_, debug_, famos_, binOfMaximum_, maxNrSamples_, nbMaxStrips_, tpInfoPrintout_); // initialise data structures initStructures(towerMapEB_); diff --git a/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.cc b/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.cc index 7eb98c1d82371..68093bdc2fae2 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.cc +++ b/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.cc @@ -16,53 +16,37 @@ // // system include files -#include -#include #include #include +#include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" - #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h" #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.h" EcalTPCondAnalyzer::EcalTPCondAnalyzer(const edm::ParameterSet &iConfig) - -{} + : tokenEndcapGeom_(esConsumes(edm::ESInputTag("", "EcalEndcap"))), + tokenBarrelGeom_(esConsumes(edm::ESInputTag("", "EcalBarrel"))), + tokenEcalTPGPhysics_(esConsumes()), + tokenEcalTPGLinearization_(esConsumes()), + tokenEcalTPGPedestals_(esConsumes()), + tokenEcalTPGWeightIdMap_(esConsumes()), + tokenEcalTPGFineGrainEBIdMap_(esConsumes()), + tokenEcalTPGLutIdMap_(esConsumes()), + tokenEcalTPGSlidingWindow_(esConsumes()), + tokenEcalTPGFineGrainStripEE_(esConsumes()), + tokenEcalTPGWeightGroup_(esConsumes()), + tokenEcalTPGLutGroup_(esConsumes()), + tokenEcalTPGFineGrainEBGroup_(esConsumes()), + tokenEcalTPGSpike_(esConsumes()), + tokenEcalTPGFineGrainTowerEE_(esConsumes()) {} void EcalTPCondAnalyzer::beginRun(const edm::Run &run, edm::EventSetup const &evtSetup) { // get geometry - - edm::ESHandle theEndcapGeometry_handle, theBarrelGeometry_handle; - evtSetup.get().get("EcalEndcap", theEndcapGeometry_handle); - evtSetup.get().get("EcalBarrel", theBarrelGeometry_handle); - theEndcapGeometry_ = &(*theEndcapGeometry_handle); - theBarrelGeometry_ = &(*theBarrelGeometry_handle); + theEndcapGeometry_ = &evtSetup.getData(tokenEndcapGeom_); + theBarrelGeometry_ = &evtSetup.getData(tokenBarrelGeom_); cacheID_ = this->getRecords(evtSetup); } @@ -77,92 +61,42 @@ unsigned long long EcalTPCondAnalyzer::getRecords(edm::EventSetup const &setup) // printComment(); - edm::ESHandle theEcalTPGPhysConst_handle; - setup.get().get(theEcalTPGPhysConst_handle); - const EcalTPGPhysicsConst *ecaltpPhysConst = theEcalTPGPhysConst_handle.product(); + const auto ecaltpPhysConst = &setup.getData(tokenEcalTPGPhysics_); printEcalTPGPhysicsConst(ecaltpPhysConst); - // for EcalFenixStrip... + // for EcalFenixStrip... // get parameter records for xtals - edm::ESHandle theEcalTPGLinearization_handle; - setup.get().get(theEcalTPGLinearization_handle); - const EcalTPGLinearizationConst *ecaltpLin = theEcalTPGLinearization_handle.product(); - - edm::ESHandle theEcalTPGPedestals_handle; - setup.get().get(theEcalTPGPedestals_handle); - const EcalTPGPedestals *ecaltpPed = theEcalTPGPedestals_handle.product(); + const auto *ecaltpLin = &setup.getData(tokenEcalTPGLinearization_); + const auto *ecaltpPed = &setup.getData(tokenEcalTPGPedestals_); printCRYSTAL(ecaltpPed, ecaltpLin); // weight - edm::ESHandle theEcalTPGWEightIdMap_handle; - setup.get().get(theEcalTPGWEightIdMap_handle); - const EcalTPGWeightIdMap *ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product(); + const auto *ecaltpgWeightMap = &setup.getData(tokenEcalTPGWeightIdMap_); printWEIGHT(ecaltpgWeightMap); // .. and for EcalFenixTcp - - edm::ESHandle theEcalTPGFineGrainEBIdMap_handle; - setup.get().get(theEcalTPGFineGrainEBIdMap_handle); - const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB = theEcalTPGFineGrainEBIdMap_handle.product(); + const auto *ecaltpgFineGrainEB = &setup.getData(tokenEcalTPGFineGrainEBIdMap_); printEcalTPGFineGrainEBIdMap(ecaltpgFineGrainEB); - edm::ESHandle theEcalTPGLutIdMap_handle; - setup.get().get(theEcalTPGLutIdMap_handle); - const EcalTPGLutIdMap *ecaltpgLut = theEcalTPGLutIdMap_handle.product(); + const auto *ecaltpgLut = &setup.getData(tokenEcalTPGLutIdMap_); printEcalTPGLutIdMap(ecaltpgLut); // for strips - edm::ESHandle theEcalTPGSlidingWindow_handle; - setup.get().get(theEcalTPGSlidingWindow_handle); - const EcalTPGSlidingWindow *ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product(); - edm::ESHandle theEcalTPGFineGrainStripEE_handle; - setup.get().get(theEcalTPGFineGrainStripEE_handle); - const EcalTPGFineGrainStripEE *ecaltpgFgStripEE = theEcalTPGFineGrainStripEE_handle.product(); - edm::ESHandle theEcalTPGWEightGroup_handle; - setup.get().get(theEcalTPGWEightGroup_handle); - const EcalTPGWeightGroup *ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product(); + const auto *ecaltpgSlidW = &setup.getData(tokenEcalTPGSlidingWindow_); + const auto *ecaltpgFgStripEE = &setup.getData(tokenEcalTPGFineGrainStripEE_); + const auto *ecaltpgWeightGroup = &setup.getData(tokenEcalTPGWeightGroup_); printSTRIP(ecaltpgSlidW, ecaltpgWeightGroup, ecaltpgFgStripEE); // get parameter records for towers - edm::ESHandle theEcalTPGLutGroup_handle; - setup.get().get(theEcalTPGLutGroup_handle); - const EcalTPGLutGroup *ecaltpgLutGroup = theEcalTPGLutGroup_handle.product(); - - edm::ESHandle theEcalTPGFineGrainEBGroup_handle; - setup.get().get(theEcalTPGFineGrainEBGroup_handle); - const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup = theEcalTPGFineGrainEBGroup_handle.product(); - edm::ESHandle theEcalTPGSpike_handle; - setup.get().get(theEcalTPGSpike_handle); - const EcalTPGSpike *ecaltpgSpikeTh = theEcalTPGSpike_handle.product(); + const auto *ecaltpgLutGroup = &setup.getData(tokenEcalTPGLutGroup_); + const auto *ecaltpgFgEBGroup = &setup.getData(tokenEcalTPGFineGrainEBGroup_); + const auto *ecaltpgSpikeTh = &setup.getData(tokenEcalTPGSpike_); + const auto *ecaltpgFineGrainTowerEE = &setup.getData(tokenEcalTPGFineGrainTowerEE_); printTOWEREB(ecaltpgSpikeTh, ecaltpgFgEBGroup, ecaltpgLutGroup); - edm::ESHandle theEcalTPGFineGrainTowerEE_handle; - setup.get().get(theEcalTPGFineGrainTowerEE_handle); - const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE = theEcalTPGFineGrainTowerEE_handle.product(); - printTOWEREE(ecaltpgFineGrainTowerEE, ecaltpgLutGroup); - // get parameters for BadX - /* edm::ESHandle theEcalTPGCrystalStatus_handle; - setup.get().get(theEcalTPGCrystalStatus_handle); - const EcalTPGCrystalStatus * ecaltpgBadX = - theEcalTPGCrystalStatus_handle.product(); printBadX(ecaltpgBadX); - - // get parameters for BadTT - edm::ESHandle theEcalTPGTowerStatus_handle; - setup.get().get(theEcalTPGTowerStatus_handle); - const EcalTPGTowerStatus * ecaltpgBadTT = - theEcalTPGTowerStatus_handle.product(); printBadTT(ecaltpgBadTT); - */ - - // get parameters for BadStrip - /* edm::ESHandle theEcalTPGStripStatus_handle; - setup.get().get(theEcalTPGStripStatus_handle); - const EcalTPGStripStatus * ecaltpgBadStrip = - theEcalTPGStripStatus_handle.product(); printBadStrip(ecaltpgBadStrip); - */ - - std::cout << "EOF" << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "EOF"; return setup.get().cacheIdentifier(); } @@ -172,19 +106,21 @@ void EcalTPCondAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup void EcalTPCondAnalyzer::endJob() {} +void EcalTPCondAnalyzer::endRun(edm::Run const &, edm::EventSetup const &) {} + void EcalTPCondAnalyzer::printEcalTPGPhysicsConst(const EcalTPGPhysicsConst *ecaltpgPhysConst) const { EcalTPGPhysicsConstMapIterator it; const EcalTPGPhysicsConstMap &mymap = ecaltpgPhysConst->getMap(); for (it = mymap.begin(); it != mymap.end(); ++it) { if (it == mymap.begin()) { - std::cout << "\nPHYSICS_EB " << (*it).first << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "\nPHYSICS_EB " << (*it).first; } else { - std::cout << "\nPHYSICS_EE " << (*it).first << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "\nPHYSICS_EE " << (*it).first; } - std::cout << (*it).second.EtSat << " " << (*it).second.ttf_threshold_Low << " " << (*it).second.ttf_threshold_High - << std::endl; - std::cout << (*it).second.FG_lowThreshold << " " << (*it).second.FG_highThreshold << " " << (*it).second.FG_lowRatio - << " " << (*it).second.FG_highRatio << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") + << (*it).second.EtSat << " " << (*it).second.ttf_threshold_Low << " " << (*it).second.ttf_threshold_High; + edm::LogVerbatim("EcalTPCondAnalyzer") << (*it).second.FG_lowThreshold << " " << (*it).second.FG_highThreshold + << " " << (*it).second.FG_lowRatio << " " << (*it).second.FG_highRatio; } } @@ -198,18 +134,18 @@ void EcalTPCondAnalyzer::printSTRIP(const EcalTPGSlidingWindow *slWin, const EcalTPGGroups::EcalTPGGroupsMap &gMap = ecaltpgWeightGroup->getMap(); EcalTPGGroups::EcalTPGGroupsMapItr groupId; - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); for (int mysub = 1; mysub <= 2; ++mysub) { - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); for (it = slwinmap.begin(); it != slwinmap.end(); ++it) { EcalTriggerElectronicsId elid((*it).first); groupId = gMap.find((*it).first); int subdet = elid.subdet(); if (subdet == mysub) { if (subdet == 1) { - std::cout << "STRIP_EB " << std::dec << (*it).first << std::endl; - std::cout << std::hex << "0x" << (*it).second << std::endl; - std::cout << "" << (*groupId).second << std::endl; // weightgroupid + edm::LogVerbatim("EcalTPCondAnalyzer") << "STRIP_EB " << std::dec << (*it).first << "\n" + << std::hex << "0x" << (*it).second << "\n" + << "" << (*groupId).second; // weightgroupid EcalTPGFineGrainStripEEMapIterator it2 = fgstripEEmap.find((*it).first); if (it2 == fgstripEEmap.end()) { edm::LogWarning("EcalTPGCondAnalyzer") << " could not find strip Id " << (*it).first @@ -217,12 +153,12 @@ void EcalTPCondAnalyzer::printSTRIP(const EcalTPGSlidingWindow *slWin, "EcalTPGFineGranStripEEMap!!!"; } else { EcalTPGFineGrainStripEE::Item item = (*it2).second; - std::cout << std::hex << "0x" << item.threshold << " 0x" << item.lut << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << std::hex << "0x" << item.threshold << " 0x" << item.lut; } } else if (subdet == 2) { - std::cout << "STRIP_EE " << std::dec << (*it).first << std::endl; - std::cout << std::hex << "0x" << (*it).second << std::endl; - std::cout << " " << (*groupId).second << std::endl; // weightgroupid + edm::LogVerbatim("EcalTPCondAnalyzer") << "STRIP_EE " << std::dec << (*it).first << "\n" + << std::hex << "0x" << (*it).second << "\n" + << " " << (*groupId).second; // weightgroupid EcalTPGFineGrainStripEEMapIterator it2 = fgstripEEmap.find((*it).first); if (it2 == fgstripEEmap.end()) { edm::LogWarning("EcalTPGCondAnalyzer") << " could not find strip Id " << (*it).first @@ -230,7 +166,7 @@ void EcalTPCondAnalyzer::printSTRIP(const EcalTPGSlidingWindow *slWin, "EcalTPGFineGranStripEEMap!!!"; } else { EcalTPGFineGrainStripEE::Item item = (*it2).second; - std::cout << std::hex << "0x" << item.threshold << " 0x" << item.lut << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << std::hex << "0x" << item.threshold << " 0x" << item.lut; } } } @@ -239,16 +175,15 @@ void EcalTPCondAnalyzer::printSTRIP(const EcalTPGSlidingWindow *slWin, } void EcalTPCondAnalyzer::printWEIGHT(const EcalTPGWeightIdMap *ecaltpgWeightIdMap) const { - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); EcalTPGWeightIdMap::EcalTPGWeightMapItr it; uint32_t w0, w1, w2, w3, w4; const EcalTPGWeightIdMap::EcalTPGWeightMap &map = ecaltpgWeightIdMap->getMap(); for (it = map.begin(); it != map.end(); ++it) { - std::cout << "WEIGHT " << (*it).first << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "WEIGHT " << (*it).first; (*it).second.getValues(w0, w1, w2, w3, w4); - std::cout << std::hex << "0x" << w0 << " 0x" << w1 << " 0x" << w2 << " 0x" << w3 << " 0x" << w4 << " " << std::endl; - std::cout << std::endl; - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") + << std::hex << "0x" << w0 << " 0x" << w1 << " 0x" << w2 << " 0x" << w3 << " 0x" << w4 << " \n\n\n"; } } @@ -257,12 +192,11 @@ void EcalTPCondAnalyzer::printEcalTPGFineGrainEBIdMap(const EcalTPGFineGrainEBId const EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMap &map = ecaltpgFineGrainEB->getMap(); uint32_t ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT; - // std::cout<getMap(); - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); for (it = map.begin(); it != map.end(); ++it) { - std::cout << "LUT " << (*it).first << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "LUT " << (*it).first; const unsigned int *lut = (*it).second.getLut(); for (unsigned int i = 0; i < 1024; ++i) - std::cout << std::hex << "0x" << *lut++ << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << std::hex << "0x" << *lut++; } } void EcalTPCondAnalyzer::printCRYSTAL(const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin) { - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); const EcalTPGPedestalsMap &pedMap = ecaltpPed->getMap(); const EcalTPGLinearizationConstMap &linMap = ecaltpLin->getMap(); const std::vector &ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel); - std::cout << "COMMENT ====== barrel crystals ====== " << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "COMMENT ====== barrel crystals ====== "; for (std::vector::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) { EBDetId id(*it); - std::cout << "CRYSTAL " << std::dec << id.rawId() << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "CRYSTAL " << std::dec << id.rawId(); const EcalTPGPedestal &ped = pedMap[id.rawId()]; const EcalTPGLinearizationConstant &lin = linMap[id.rawId()]; - std::cout << std::hex << " 0x" << ped.mean_x12 << " 0x" << lin.mult_x12 << " 0x" << lin.shift_x12 << std::endl; - std::cout << std::hex << " 0x" << ped.mean_x6 << " 0x" << lin.mult_x6 << " 0x" << lin.shift_x6 << std::endl; - std::cout << std::hex << " 0x" << ped.mean_x1 << " 0x" << lin.mult_x1 << " 0x" << lin.shift_x1 << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") + << std::hex << " 0x" << ped.mean_x12 << " 0x" << lin.mult_x12 << " 0x" << lin.shift_x12 << "\n" + << std::hex << " 0x" << ped.mean_x6 << " 0x" << lin.mult_x6 << " 0x" << lin.shift_x6 << "\n" + << std::hex << " 0x" << ped.mean_x1 << " 0x" << lin.mult_x1 << " 0x" << lin.shift_x1; } const std::vector &eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap); - std::cout << "COMMENT ====== endcap crystals ====== " << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "COMMENT ====== endcap crystals ====== "; for (std::vector::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) { EEDetId id(*it); - std::cout << "CRYSTAL " << std::dec << id.rawId() << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "CRYSTAL " << std::dec << id.rawId(); const EcalTPGPedestal &ped = pedMap[id.rawId()]; const EcalTPGLinearizationConstant &lin = linMap[id.rawId()]; - std::cout << std::hex << " 0x" << ped.mean_x12 << " 0x" << lin.mult_x12 << " 0x" << lin.shift_x12 << std::endl; - std::cout << std::hex << " 0x" << ped.mean_x6 << " 0x" << lin.mult_x6 << " 0x" << lin.shift_x6 << std::endl; - std::cout << std::hex << " 0x" << ped.mean_x1 << " 0x" << lin.mult_x1 << " 0x" << lin.shift_x1 << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") + << std::hex << " 0x" << ped.mean_x12 << " 0x" << lin.mult_x12 << " 0x" << lin.shift_x12 << "\n" + << std::hex << " 0x" << ped.mean_x6 << " 0x" << lin.mult_x6 << " 0x" << lin.shift_x6 << "\n" + << std::hex << " 0x" << ped.mean_x1 << " 0x" << lin.mult_x1 << " 0x" << lin.shift_x1; } } void EcalTPCondAnalyzer::printComment() const { - std::cout << "COMMENT put your comments here\n" - << "COMMENT =================================\n" - << "COMMENT physics EB structure\n" - << "COMMENT\n" - << "COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), " - "ttf_threshold_High (GeV)\n" - << "COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), " - "FG_lowRatio, FG_highRatio\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT physics EE structure\n" - << "COMMENT\n" - << "COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), " - "ttf_threshold_High (GeV)\n" - << "COMMENT FG_Threshold (GeV), dummy, dummy, dummy\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT crystal structure (same for EB and EE)\n" - << "COMMENT\n" - << "COMMENT ped, mult, shift [gain12]\n" - << "COMMENT ped, mult, shift [gain6]\n" - << "COMMENT ped, mult, shift [gain1]\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT strip EB structure\n" - << "COMMENT\n" - << "COMMENT sliding_window\n" - << "COMMENT weightGroupId\n" - << "COMMENT threshold_sfg lut_sfg\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT strip EE structure\n" - << "COMMENT\n" - << "COMMENT sliding_window\n" - << "COMMENT weightGroupId\n" - << "COMMENT threshold_fg lut_fg\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT tower EB structure\n" - << "COMMENT\n" - << "COMMENT LUTGroupId\n" - << "COMMENT FgGroupId\n" - << "COMMENT spike_killing_threshold\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT tower EE structure\n" - << "COMMENT\n" - << "COMMENT LUTGroupId\n" - << "COMMENT tower_lut_fg\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT Weight structure\n" - << "COMMENT\n" - << "COMMENT weightGroupId\n" - << "COMMENT w0, w1, w2, w3, w4\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT lut structure\n" - << "COMMENT\n" - << "COMMENT LUTGroupId\n" - << "COMMENT LUT[1-1024]\n" - << "COMMENT =================================\n" - << "COMMENT\n" - << "COMMENT =================================\n" - << "COMMENT fg EB structure\n" - << "COMMENT\n" - << "COMMENT FgGroupId\n" - << "COMMENT el, eh, tl, th, lut_fg\n" - << "COMMENT =================================\n" - << "COMMENT" << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "COMMENT put your comments here\n" + << "COMMENT =================================\n" + << "COMMENT physics EB structure\n" + << "COMMENT\n" + << "COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), " + "ttf_threshold_High (GeV)\n" + << "COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), " + "FG_lowRatio, FG_highRatio\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT physics EE structure\n" + << "COMMENT\n" + << "COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), " + "ttf_threshold_High (GeV)\n" + << "COMMENT FG_Threshold (GeV), dummy, dummy, dummy\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT crystal structure (same for EB and EE)\n" + << "COMMENT\n" + << "COMMENT ped, mult, shift [gain12]\n" + << "COMMENT ped, mult, shift [gain6]\n" + << "COMMENT ped, mult, shift [gain1]\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT strip EB structure\n" + << "COMMENT\n" + << "COMMENT sliding_window\n" + << "COMMENT weightGroupId\n" + << "COMMENT threshold_sfg lut_sfg\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT strip EE structure\n" + << "COMMENT\n" + << "COMMENT sliding_window\n" + << "COMMENT weightGroupId\n" + << "COMMENT threshold_fg lut_fg\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT tower EB structure\n" + << "COMMENT\n" + << "COMMENT LUTGroupId\n" + << "COMMENT FgGroupId\n" + << "COMMENT spike_killing_threshold\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT tower EE structure\n" + << "COMMENT\n" + << "COMMENT LUTGroupId\n" + << "COMMENT tower_lut_fg\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT Weight structure\n" + << "COMMENT\n" + << "COMMENT weightGroupId\n" + << "COMMENT w0, w1, w2, w3, w4\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT lut structure\n" + << "COMMENT\n" + << "COMMENT LUTGroupId\n" + << "COMMENT LUT[1-1024]\n" + << "COMMENT =================================\n" + << "COMMENT\n" + << "COMMENT =================================\n" + << "COMMENT fg EB structure\n" + << "COMMENT\n" + << "COMMENT FgGroupId\n" + << "COMMENT el, eh, tl, th, lut_fg\n" + << "COMMENT =================================\n" + << "COMMENT"; } -/*void EcalTPCondAnalyzer::printTOWEREB(const EcalTPGFineGrainEBGroup -*ecaltpgFgEBGroup,const EcalTPGLutGroup *ecaltpgLutGroup) const { - - const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap(); - EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId; - const EcalTPGGroups::EcalTPGGroupsMap &fgMap=ecaltpgFgEBGroup->getMap(); - EcalTPGGroups::EcalTPGGroupsMapItr it; - - std::cout<getMap(); EcalTPGSpike::EcalTPGSpikeMapIterator itSpikeTh; - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); for (it = fgMap.begin(); it != fgMap.end(); ++it) { - std::cout << "TOWER_EB " << std::dec << (*it).first << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "TOWER_EB " << std::dec << (*it).first; lutGroupId = lutMap.find((*it).first); itSpikeTh = spikeThMap.find((*it).first); - std::cout << " " << (*it).second << std::endl; - std::cout << " " << (*lutGroupId).second << std::endl; - std::cout << " " << (*itSpikeTh).second << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << " " << (*it).second << "\n" + << " " << (*lutGroupId).second << "\n" + << " " << (*itSpikeTh).second; } } @@ -437,94 +355,10 @@ void EcalTPCondAnalyzer::printTOWEREE(const EcalTPGFineGrainTowerEE *ecaltpgFine const EcalTPGGroups::EcalTPGGroupsMap &lutMap = ecaltpgLutGroup->getMap(); EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId; - std::cout << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer"); for (it = map.begin(); it != map.end(); ++it) { - std::cout << "TOWER_EE " << std::dec << (*it).first << std::endl; + edm::LogVerbatim("EcalTPCondAnalyzer") << "TOWER_EE " << std::dec << (*it).first; lutGroupId = lutMap.find((*it).first); - std::cout << " " << (*lutGroupId).second << std::endl; - std::cout << std::hex << "0x" << (*it).second << std::endl; - } -} - -/*void EcalTPCondAnalyzer::printBadX(const EcalTPGCrystalStatus *ecaltpgBadX) -const { - - std::ofstream myfile; - myfile.open("badXvalues.txt"); - - const EcalTPGCrystalStatusMap & badXMap = ecaltpgBadX->getMap(); - - const std::vector & ebCells = -theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel); - - myfile <<"COMMENT ====== barrel masked crystals ====== "<::const_iterator it = ebCells.begin(); it != -ebCells.end(); ++it) { - - EBDetId id(*it) ; - const EcalTPGCrystalStatusCode &badXeb=badXMap[id.rawId()]; - // Print in the text file obly the masked crystals - if (badXeb.getStatusCode() != 0){ - myfile << "" << id.rawId() << " " << id.ieta() << " " << -id.iphi() << std::endl; - } - - } - - myfile << " " << std::endl; - - const std::vector & eeCells = -theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap); - - myfile <<"COMMENT ====== endcap masked crystals ====== "<::const_iterator it = eeCells.begin(); it != -eeCells.end(); ++it) { - - EEDetId id(*it) ; - const EcalTPGCrystalStatusCode &badXee=badXMap[id.rawId()]; - // Print in the text file only the masked clystals - if (badXee.getStatusCode() != 0){ - myfile << "" << id.rawId() << " " << id.ix() << " " << id.iy() << " -"<< id.zside() << std::endl; - } + edm::LogVerbatim("EcalTPCondAnalyzer") << " " << (*lutGroupId).second << "\n" << std::hex << "0x" << (*it).second; } - - myfile.close(); } -*/ - -/*void EcalTPCondAnalyzer::printBadTT(const EcalTPGTowerStatus *ecaltpgBadTT) -const { std::ofstream myfilebadTT; myfilebadTT.open("badTTvalues.txt"); int ieta -= 0; int iphi = 0; - - const EcalTPGTowerStatusMap & badTTMap = ecaltpgBadTT -> getMap(); - EcalTPGTowerStatusMapIterator it; - - myfilebadTT <<"Barrel and endcap masked Trigger Towers"< -#include +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" // // class declaration // -class EcalTPCondAnalyzer : public edm::one::EDAnalyzer<> { +class EcalTPCondAnalyzer : public edm::one::EDAnalyzer { public: explicit EcalTPCondAnalyzer(const edm::ParameterSet &); ~EcalTPCondAnalyzer() override; void analyze(const edm::Event &, const edm::EventSetup &) override; void beginJob() override; - void beginRun(const edm::Run &run, const edm::EventSetup &es); + void beginRun(const edm::Run &run, const edm::EventSetup &evtSetup) override; void endJob() override; + void endRun(edm::Run const &, edm::EventSetup const &) override; private: unsigned long long getRecords(edm::EventSetup const &setup); unsigned long long cacheID_; + edm::ESGetToken tokenEndcapGeom_; + edm::ESGetToken tokenBarrelGeom_; + edm::ESGetToken tokenEcalTPGPhysics_; + edm::ESGetToken tokenEcalTPGLinearization_; + edm::ESGetToken tokenEcalTPGPedestals_; + edm::ESGetToken tokenEcalTPGWeightIdMap_; + edm::ESGetToken tokenEcalTPGFineGrainEBIdMap_; + edm::ESGetToken tokenEcalTPGLutIdMap_; + edm::ESGetToken tokenEcalTPGSlidingWindow_; + edm::ESGetToken tokenEcalTPGFineGrainStripEE_; + edm::ESGetToken tokenEcalTPGWeightGroup_; + edm::ESGetToken tokenEcalTPGLutGroup_; + edm::ESGetToken tokenEcalTPGFineGrainEBGroup_; + edm::ESGetToken tokenEcalTPGSpike_; + edm::ESGetToken tokenEcalTPGFineGrainTowerEE_; + const CaloSubdetectorGeometry *theEndcapGeometry_; const CaloSubdetectorGeometry *theBarrelGeometry_; @@ -82,8 +105,4 @@ class EcalTPCondAnalyzer : public edm::one::EDAnalyzer<> { void printEcalTPGFineGrainEBIdMap(const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB) const; void printTOWEREE(const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, const EcalTPGLutGroup *ecaltpgLutGroup) const; - void printBadX(const EcalTPGCrystalStatus *ecaltpgBadX) const; - void printBadTT(const EcalTPGTowerStatus *ecaltpgBadTT) const; - void printBadStrip(const EcalTPGStripStatus *ecaltpgBadStrip) const; - void printSpikeTh(const EcalTPGSpike *ecaltpgSpike) const; }; diff --git a/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTrigPrimProducer.cc b/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTrigPrimProducer.cc index 0e9cadce08b77..bad5f56c4db7a 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTrigPrimProducer.cc +++ b/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTrigPrimProducer.cc @@ -3,11 +3,11 @@ * * EcalTrigPrimProducer produces a EcalTrigPrimDigiCollection * The barrel code does a detailed simulation - * The code for the endcap is simulated in a rough way, due to missing strip + * The code for the endcap is simulated in a rough way, due to missing strip geometry * * - * \author Ursula Berthon, Stephanie Baffioni, LLR Palaiseau + * \author Ursula Berthon, Stephanie Baffioni, LLR Palaiseau * * \version 1st Version may 2006 * \version 2nd Version jul 2006 @@ -44,6 +44,9 @@ #include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" #include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" #include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h" #include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" #include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h" @@ -60,6 +63,9 @@ #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" #include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" #include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" @@ -86,6 +92,7 @@ class EcalTrigPrimProducer : public edm::stream::EDProducer<> { bool tcpFormat_; bool debug_; bool famos_; + bool tpInfoPrintout_; edm::EDGetTokenT tokenEB_; edm::EDGetTokenT tokenEE_; @@ -102,8 +109,10 @@ class EcalTrigPrimProducer : public edm::stream::EDProducer<> { // for strips edm::ESGetToken tokenEcalTPGSlidingWindow_; - edm::ESGetToken tokenEcalTPGWEightIdMap_; - edm::ESGetToken tokenEcalTPGWEightGroup_; + edm::ESGetToken tokenEcalTPGWeightIdMap_; + edm::ESGetToken tokenEcalTPGWeightGroup_; + edm::ESGetToken tokenEcalTPGOddWeightIdMap_; + edm::ESGetToken tokenEcalTPGOddWeightGroup_; edm::ESGetToken tokenEcalTPGFineGrainStripEE_; edm::ESGetToken tokenEcalTPGStripStatus_; @@ -116,6 +125,8 @@ class EcalTrigPrimProducer : public edm::stream::EDProducer<> { edm::ESGetToken tokenEcalTPGFineGrainTowerEE_; edm::ESGetToken tokenEcalTPGTowerStatus_; edm::ESGetToken tokenEcalTPGSpike_; + // TPG TP mode + edm::ESGetToken tokenEcalTPGTPMode_; int binOfMaximum_; bool fillBinOfMaximumFromHistory_; @@ -130,6 +141,7 @@ EcalTrigPrimProducer::EcalTrigPrimProducer(const edm::ParameterSet &iConfig) tcpFormat_(iConfig.getParameter("TcpOutput")), debug_(iConfig.getParameter("Debug")), famos_(iConfig.getParameter("Famos")), + tpInfoPrintout_(iConfig.getParameter("TPinfoPrintout")), tokenEB_(consumes( edm::InputTag(iConfig.getParameter("Label"), iConfig.getParameter("InstanceEB")))), tokenEE_(consumes( @@ -139,8 +151,10 @@ EcalTrigPrimProducer::EcalTrigPrimProducer(const edm::ParameterSet &iConfig) tokenEcalTPGPedestals_(esConsumes()), tokenEcalTPGCrystalStatus_(esConsumes()), tokenEcalTPGSlidingWindow_(esConsumes()), - tokenEcalTPGWEightIdMap_(esConsumes()), - tokenEcalTPGWEightGroup_(esConsumes()), + tokenEcalTPGWeightIdMap_(esConsumes()), + tokenEcalTPGWeightGroup_(esConsumes()), + tokenEcalTPGOddWeightIdMap_(esConsumes()), + tokenEcalTPGOddWeightGroup_(esConsumes()), tokenEcalTPGFineGrainStripEE_(esConsumes()), tokenEcalTPGStripStatus_(esConsumes()), tokenEcalTPGFineGrainEBGroup_(esConsumes()), @@ -150,6 +164,7 @@ EcalTrigPrimProducer::EcalTrigPrimProducer(const edm::ParameterSet &iConfig) tokenEcalTPGFineGrainTowerEE_(esConsumes()), tokenEcalTPGTowerStatus_(esConsumes()), tokenEcalTPGSpike_(esConsumes()), + tokenEcalTPGTPMode_(esConsumes()), binOfMaximum_(iConfig.getParameter("binOfMaximum")), fillBinOfMaximumFromHistory_(-1 == binOfMaximum_), cacheID_(0) { @@ -210,12 +225,13 @@ void EcalTrigPrimProducer::beginRun(edm::Run const &run, edm::EventSetup const & auto const &ecalmapping = setup.getData(tokenEcalMapping_); if (barrelOnly_) { - algo_ = std::make_unique(&ecalmapping, binOfMaximum_, tcpFormat_, debug_, famos_); + algo_ = std::make_unique( + &ecalmapping, binOfMaximum_, tcpFormat_, debug_, famos_, tpInfoPrintout_); } else { auto const &endcapGeometry = setup.getData(tokenEndcapGeom_); auto const &eTTmap = setup.getData(tokenETTMap_); algo_ = std::make_unique( - &eTTmap, &endcapGeometry, &ecalmapping, binOfMaximum_, tcpFormat_, debug_, famos_); + &eTTmap, &endcapGeometry, &ecalmapping, binOfMaximum_, tcpFormat_, debug_, famos_, tpInfoPrintout_); } } @@ -235,19 +251,25 @@ unsigned long long EcalTrigPrimProducer::getRecords(edm::EventSetup const &setup // for strips const EcalTPGSlidingWindow *ecaltpgSlidW = &setup.getData(tokenEcalTPGSlidingWindow_); - const EcalTPGWeightIdMap *ecaltpgWeightMap = &setup.getData(tokenEcalTPGWEightIdMap_); - const EcalTPGWeightGroup *ecaltpgWeightGroup = &setup.getData(tokenEcalTPGWEightGroup_); + const EcalTPGWeightIdMap *ecaltpgWeightMap = &setup.getData(tokenEcalTPGWeightIdMap_); + const EcalTPGWeightGroup *ecaltpgWeightGroup = &setup.getData(tokenEcalTPGWeightGroup_); + const EcalTPGOddWeightIdMap *ecaltpgOddWeightMap = &setup.getData(tokenEcalTPGOddWeightIdMap_); + const EcalTPGOddWeightGroup *ecaltpgOddWeightGroup = &setup.getData(tokenEcalTPGOddWeightGroup_); const EcalTPGFineGrainStripEE *ecaltpgFgStripEE = &setup.getData(tokenEcalTPGFineGrainStripEE_); const EcalTPGStripStatus *ecaltpgStripStatus = &setup.getData(tokenEcalTPGStripStatus_); + const EcalTPGTPMode *ecaltpgTPMode = &setup.getData(tokenEcalTPGTPMode_); algo_->setPointers(ecaltpLin, ecaltpPed, ecaltpgSlidW, ecaltpgWeightMap, ecaltpgWeightGroup, + ecaltpgOddWeightMap, + ecaltpgOddWeightGroup, ecaltpgFgStripEE, ecaltpgBadX, - ecaltpgStripStatus); + ecaltpgStripStatus, + ecaltpgTPMode); // .. and for EcalFenixTcp // get parameter records for towers @@ -265,7 +287,8 @@ unsigned long long EcalTrigPrimProducer::getRecords(edm::EventSetup const &setup ecaltpgFineGrainEB, ecaltpgFineGrainTowerEE, ecaltpgBadTT, - ecaltpgSpike); + ecaltpgSpike, + ecaltpgTPMode); // we will suppose that everything is to be updated if the // EcalTPGLinearizationConstRcd has changed @@ -379,6 +402,7 @@ void EcalTrigPrimProducer::fillDescriptions(edm::ConfigurationDescriptions &desc // The code before the existence of fillDescriptions did something special if // 'binOfMaximum' was missing. This replicates that behavior. desc.add("binOfMaximum", -1)->setComment(kComment); + desc.add("TPinfoPrintout", false); descriptions.addDefault(desc); } diff --git a/SimCalorimetry/EcalTrigPrimProducers/python/ecalTrigPrimESDoubleWeights_cff.py b/SimCalorimetry/EcalTrigPrimProducers/python/ecalTrigPrimESDoubleWeights_cff.py new file mode 100644 index 0000000000000..aa9d2fa118561 --- /dev/null +++ b/SimCalorimetry/EcalTrigPrimProducers/python/ecalTrigPrimESDoubleWeights_cff.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms +from CondCore.CondDB.CondDB_cfi import * + +CondDB.connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS') + +EcalTPGDoubleWeightRecords = cms.ESSource("PoolDBESSource",CondDB, + toGet = cms.VPSet( + cms.PSet(record = cms.string("EcalTPGOddWeightGroupRcd"), + tag = cms.string("EcalTPGOddWeightGroup_mc")), + cms.PSet(record = cms.string("EcalTPGOddWeightIdMapRcd"), + tag = cms.string("EcalTPGOddWeightIdMap_mc")), + cms.PSet(record = cms.string("EcalTPGTPModeRcd"), + tag = cms.string("EcalTPGTPMode_mc")), + ) + ) diff --git a/SimCalorimetry/EcalTrigPrimProducers/python/ecalTriggerPrimitiveDigis_cff.py b/SimCalorimetry/EcalTrigPrimProducers/python/ecalTriggerPrimitiveDigis_cff.py index 1b23381a89e18..e32ea15ffae0f 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/python/ecalTriggerPrimitiveDigis_cff.py +++ b/SimCalorimetry/EcalTrigPrimProducers/python/ecalTriggerPrimitiveDigis_cff.py @@ -9,6 +9,9 @@ # #from SimCalorimetry.EcalTrigPrimProducers.ecalTrigPrimESProducer_cff import * +# Import the records for the new odd weights from tags not yet in the GT +from SimCalorimetry.EcalTrigPrimProducers.ecalTrigPrimESDoubleWeights_cff import * + #Common from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( simEcalTriggerPrimitiveDigis, BarrelOnly = cms.bool(True) ) diff --git a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_GlobalTag_cfg.py b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_GlobalTag_cfg.py index 8df2cd7b33f94..685d6b27b7582 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_GlobalTag_cfg.py +++ b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_GlobalTag_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms process = cms.Process("TPDBAn") -process.load("CondCore.DBCommon.CondDBSetup_cfi") +process.load("CondCore.CondDB.CondDB_cfi") process.load("Geometry.CaloEventSetup.CaloGeometry_cfi") @@ -17,13 +17,28 @@ # firstRun = cms.untracked.uint32(135175) ) -process.load("CondCore.DBCommon.CondDBCommon_cfi") -process.CondDBCommon.DBParameters.authenticationPath = '/afs/cern.ch/cms/DB/conddb' process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.prefer("GlobalTag") -process.GlobalTag.globaltag = 'GR10_P_V5::All' +process.GlobalTag.globaltag = '112X_dataRun3_HLT_v3' process.tpDBAnalyzer = cms.EDAnalyzer("EcalTPCondAnalyzer") +process.MessageLogger = cms.Service("MessageLogger", + cerr = cms.untracked.PSet( + enable = cms.untracked.bool(False) + ), + cout = cms.untracked.PSet( + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + EcalTPCondAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(100000000) + ), + enable = cms.untracked.bool(True), + threshold = cms.untracked.string('DEBUG') + ), + debugModules = cms.untracked.vstring('tpDBAnalyzer') +) + process.p = cms.Path(process.tpDBAnalyzer) diff --git a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_ideal_cfg.py b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_ideal_cfg.py index dfeb68cb73c26..211d85a7eb57b 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_ideal_cfg.py +++ b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_ideal_cfg.py @@ -97,4 +97,21 @@ process.tpDBAnalyzer = cms.EDAnalyzer("EcalTPCondAnalyzer") +process.MessageLogger = cms.Service("MessageLogger", + cerr = cms.untracked.PSet( + enable = cms.untracked.bool(False) + ), + cout = cms.untracked.PSet( + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + EcalTPCondAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(100000000) + ), + enable = cms.untracked.bool(True), + threshold = cms.untracked.string('DEBUG') + ), + debugModules = cms.untracked.vstring('tpDBAnalyzer') +) + process.p = cms.Path(process.tpDBAnalyzer) diff --git a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_startup_cfg.py b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_startup_cfg.py index 5fc22a321ceb7..c5c9bde35cf1b 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_startup_cfg.py +++ b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_beamv5_startup_cfg.py @@ -97,4 +97,21 @@ process.tpDBAnalyzer = cms.EDAnalyzer("EcalTPCondAnalyzer") +process.MessageLogger = cms.Service("MessageLogger", + cerr = cms.untracked.PSet( + enable = cms.untracked.bool(False) + ), + cout = cms.untracked.PSet( + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + EcalTPCondAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(100000000) + ), + enable = cms.untracked.bool(True), + threshold = cms.untracked.string('DEBUG') + ), + debugModules = cms.untracked.vstring('tpDBAnalyzer') +) + process.p = cms.Path(process.tpDBAnalyzer) diff --git a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_cfg.py b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_cfg.py index 1d47594287dd2..4a22858833551 100644 --- a/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_cfg.py +++ b/SimCalorimetry/EcalTrigPrimProducers/test/readDBTPConds_cfg.py @@ -88,6 +88,22 @@ process.tpDBAnalyzer = cms.EDAnalyzer("EcalTPCondAnalyzer") -process.p = cms.Path(process.tpDBAnalyzer) +process.MessageLogger = cms.Service("MessageLogger", + cerr = cms.untracked.PSet( + enable = cms.untracked.bool(False) + ), + cout = cms.untracked.PSet( + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + EcalTPCondAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(100000000) + ), + enable = cms.untracked.bool(True), + threshold = cms.untracked.string('DEBUG') + ), + debugModules = cms.untracked.vstring('tpDBAnalyzer') +) +process.p = cms.Path(process.tpDBAnalyzer) diff --git a/SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h b/SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h index 5a0b2b04d0f1f..bacdee9bbb3cb 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h +++ b/SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h @@ -4,12 +4,14 @@ #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include -void removeCPFromPU(const std::vector& caloParticles, std::vector& cPIndices) { +static void removeCPFromPU(const std::vector& caloParticles, + std::vector& cPIndices, + bool hardScatterOnly = true) { //Consider CaloParticles coming from the hard scatterer //excluding the PU contribution and save the indices. for (unsigned int cpId = 0; cpId < caloParticles.size(); ++cpId) { - if (caloParticles[cpId].g4Tracks()[0].eventId().event() != 0 or - caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() != 0) { + if (hardScatterOnly && (caloParticles[cpId].g4Tracks()[0].eventId().event() != 0 or + caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { LogDebug("HGCalValidator") << "Excluding CaloParticles from event: " << caloParticles[cpId].g4Tracks()[0].eventId().event() << " with BX: " << caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() @@ -19,4 +21,5 @@ void removeCPFromPU(const std::vector& caloParticles, std::vector< cPIndices.emplace_back(cpId); } } + #endif diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc index 2a63778286cef..39d61303997bd 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc @@ -28,7 +28,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( std::vector cPIndices; //Consider CaloParticles coming from the hard scatterer //excluding the PU contribution and save the indices. - removeCPFromPU(caloParticles, cPIndices); + removeCPFromPU(caloParticles, cPIndices, hardScatterOnly_); auto nCaloParticles = cPIndices.size(); // Initialize cPOnLayer. To be returned outside, since it contains the diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc new file mode 100644 index 0000000000000..4cf5d8d3f79d8 --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc @@ -0,0 +1,94 @@ +// +// Original Author: Leonardo Cristella +// Created: Tue Feb 2 10:52:11 CET 2021 +// +// + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/global/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/Framework/interface/ESHandle.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" +#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" + +#include "FWCore/Utilities/interface/EDGetToken.h" + +// +// class decleration +// + +class MCToCPAssociatorEDProducer : public edm::global::EDProducer<> { +public: + explicit MCToCPAssociatorEDProducer(const edm::ParameterSet &); + ~MCToCPAssociatorEDProducer() override; + +private: + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; + + edm::EDGetTokenT CPCollectionToken_; + edm::EDGetTokenT MCCollectionToken_; + edm::EDGetTokenT associatorToken_; +}; + +MCToCPAssociatorEDProducer::MCToCPAssociatorEDProducer(const edm::ParameterSet &pset) { + produces(); + produces(); + + CPCollectionToken_ = consumes(pset.getParameter("label_cp")); + MCCollectionToken_ = consumes(pset.getParameter("label_mcl")); + associatorToken_ = + consumes(pset.getParameter("associator")); +} + +MCToCPAssociatorEDProducer::~MCToCPAssociatorEDProducer() {} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +void MCToCPAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const { + using namespace edm; + + edm::Handle theAssociator; + iEvent.getByToken(associatorToken_, theAssociator); + + Handle CPCollection; + iEvent.getByToken(CPCollectionToken_, CPCollection); + + Handle MCCollection; + iEvent.getByToken(MCCollectionToken_, MCCollection); + + // associate MutiCluster and CP + LogTrace("AssociatorValidator") << "Calling associateRecoToSim method" + << "\n"; + hgcal::RecoToSimCollectionWithMultiClusters recSimColl = + theAssociator->associateRecoToSim(MCCollection, CPCollection); + + LogTrace("AssociatorValidator") << "Calling associateSimToReco method" + << "\n"; + hgcal::SimToRecoCollectionWithMultiClusters simRecColl = + theAssociator->associateSimToReco(MCCollection, CPCollection); + + auto rts = std::make_unique(recSimColl); + auto str = std::make_unique(simRecColl); + + iEvent.put(std::move(rts)); + iEvent.put(std::move(str)); +} + +// define this as a plug-in +DEFINE_FWK_MODULE(MCToCPAssociatorEDProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.cc new file mode 100644 index 0000000000000..e1c22ec2aa925 --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.cc @@ -0,0 +1,529 @@ +// Original Author: Leonardo Cristella +// + +#include "MultiClusterAssociatorByEnergyScoreImpl.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h" + +MultiClusterAssociatorByEnergyScoreImpl::MultiClusterAssociatorByEnergyScoreImpl( + edm::EDProductGetter const& productGetter, + bool hardScatterOnly, + std::shared_ptr recHitTools, + const std::unordered_map*& hitMap) + : hardScatterOnly_(hardScatterOnly), recHitTools_(recHitTools), hitMap_(hitMap), productGetter_(&productGetter) { + layers_ = recHitTools_->lastLayerBH(); +} + +hgcal::association MultiClusterAssociatorByEnergyScoreImpl::makeConnections( + const edm::Handle& mCCH, const edm::Handle& cPCH) const { + // 1. Extract collections and filter CaloParticles, if required + const auto& mClusters = *mCCH.product(); + const auto& caloParticles = *cPCH.product(); + auto nMultiClusters = mClusters.size(); + //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. + std::vector cPIndices; + //Consider CaloParticles coming from the hard scatterer + //excluding the PU contribution and save the indices. + removeCPFromPU(caloParticles, cPIndices, false); + auto nCaloParticles = cPIndices.size(); + + std::vector cPSelectedIndices; + removeCPFromPU(caloParticles, cPSelectedIndices, true); + + //cPOnLayer[caloparticle][layer] + //This defines a "caloParticle on layer" concept. It is only filled in case + //that caloParticle has a reconstructed hit related via detid. So, a cPOnLayer[i][j] connects a + //specific caloParticle i in layer j with: + //1. the sum of all recHits energy times fraction of the relevant simHit in layer j related to that caloParticle i. + //2. the hits and fractions of that caloParticle i in layer j. + //3. the layer clusters with matched recHit id. + hgcal::caloParticleToMultiCluster cPOnLayer; + cPOnLayer.resize(nCaloParticles); + for (unsigned int i = 0; i < nCaloParticles; ++i) { + auto cpIndex = cPIndices[i]; + cPOnLayer[cpIndex].resize(layers_ * 2); + for (unsigned int j = 0; j < layers_ * 2; ++j) { + cPOnLayer[cpIndex][j].caloParticleId = cpIndex; + cPOnLayer[cpIndex][j].energy = 0.f; + cPOnLayer[cpIndex][j].hits_and_fractions.clear(); + } + } + + std::unordered_map> detIdToCaloParticleId_Map; + // Fill detIdToCaloParticleId_Map and update cPOnLayer + for (const auto& cpId : cPIndices) { + //take sim clusters + const SimClusterRefVector& simClusterRefVector = caloParticles[cpId].simClusters(); + //loop through sim clusters + for (const auto& it_sc : simClusterRefVector) { + const SimCluster& simCluster = (*(it_sc)); + const auto& hits_and_fractions = simCluster.hits_and_fractions(); + for (const auto& it_haf : hits_and_fractions) { + const auto hitid = (it_haf.first); + const auto cpLayerId = + recHitTools_->getLayerWithOffset(hitid) + layers_ * ((recHitTools_->zside(hitid) + 1) >> 1) - 1; + const auto itcheck = hitMap_->find(hitid); + if (itcheck != hitMap_->end()) { + //Since the current hit from sim cluster has a reconstructed hit with the same detid, + //make a map that will connect a detid with: + //1. the caloParticles that have a simcluster with sim hits in that cell via caloParticle id. + //2. the sum of all simHits fractions that contributes to that detid. + //So, keep in mind that in case of multiple caloParticles contributing in the same cell + //the fraction is the sum over all caloParticles. So, something like: + //detid: (caloParticle 1, sum of hits fractions in that detid over all cp) , (caloParticle 2, sum of hits fractions in that detid over all cp), (caloParticle 3, sum of hits fractions in that detid over all cp) ... + auto hit_find_it = detIdToCaloParticleId_Map.find(hitid); + if (hit_find_it == detIdToCaloParticleId_Map.end()) { + detIdToCaloParticleId_Map[hitid] = std::vector(); + detIdToCaloParticleId_Map[hitid].emplace_back(cpId, it_haf.second); + } else { + auto findHitIt = std::find(detIdToCaloParticleId_Map[hitid].begin(), + detIdToCaloParticleId_Map[hitid].end(), + hgcal::detIdInfoInCluster{cpId, it_haf.second}); + if (findHitIt != detIdToCaloParticleId_Map[hitid].end()) { + findHitIt->fraction += it_haf.second; + } else { + detIdToCaloParticleId_Map[hitid].emplace_back(cpId, it_haf.second); + } + } + const HGCRecHit* hit = itcheck->second; + //Since the current hit from sim cluster has a reconstructed hit with the same detid, + //fill the cPOnLayer[caloparticle][layer] object with energy (sum of all recHits energy times fraction + //of the relevant simHit) and keep the hit (detid and fraction) that contributed. + cPOnLayer[cpId][cpLayerId].energy += it_haf.second * hit->energy(); + // We need to compress the hits and fractions in order to have a + // reasonable score between CP and LC. Imagine, for example, that a + // CP has detID X used by 2 SimClusters with different fractions. If + // a single LC uses X with fraction 1 and is compared to the 2 + // contributions separately, it will be assigned a score != 0, which + // is wrong. + auto& haf = cPOnLayer[cpId][cpLayerId].hits_and_fractions; + auto found = std::find_if( + std::begin(haf), std::end(haf), [&hitid](const std::pair& v) { return v.first == hitid; }); + if (found != haf.end()) { + found->second += it_haf.second; + } else { + cPOnLayer[cpId][cpLayerId].hits_and_fractions.emplace_back(hitid, it_haf.second); + } + } + } // end of loop through simHits + } // end of loop through simclusters + } // end of loop through caloParticles + +#ifdef EDM_ML_DEBUG + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << "cPOnLayer INFO" << std::endl; + for (size_t cp = 0; cp < cPOnLayer.size(); ++cp) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; + for (size_t cpp = 0; cpp < cPOnLayer[cp].size(); ++cpp) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << " CaloParticleIdx: " << cPOnLayer[cp][cpp].caloParticleId << std::endl; + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << " Energy: " << cPOnLayer[cp][cpp].energy << std::endl; + double tot_energy = 0.; + for (auto const& haf : cPOnLayer[cp][cpp].hits_and_fractions) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + << haf.second * hitMap_->at(haf.first)->energy() << std::endl; + tot_energy += haf.second * hitMap_->at(haf.first)->energy(); + } + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + for (auto const& mc : cPOnLayer[cp][cpp].multiClusterIdToEnergyAndScore) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << " mcIdx/energy/score: " << mc.first << "/" + << mc.second.first << "/" << mc.second.second << std::endl; + } + } + } + + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << "detIdToCaloParticleId_Map INFO" << std::endl; + for (auto const& cp : detIdToCaloParticleId_Map) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << "For detId: " << (uint32_t)cp.first + << " we have found the following connections with CaloParticles:" << std::endl; + for (auto const& cpp : cp.second) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << " CaloParticle Id: " << cpp.clusterId << " with fraction: " << cpp.fraction + << " and energy: " << cpp.fraction * hitMap_->at(cp.first)->energy() << std::endl; + } + } +#endif + + // Fill detIdToMultiClusterId_Map and cpsInMultiCluster; update cPOnLayer + std::unordered_map> detIdToMultiClusterId_Map; + + // this contains the ids of the caloParticles contributing with at least one hit to the multiCluster and the reconstruction error + //cpsInMultiCluster[multicluster][CPids] + //Connects a multiCluster with all related caloParticles. + hgcal::multiClusterToCaloParticle cpsInMultiCluster; + cpsInMultiCluster.resize(nMultiClusters); + + //Loop through multiClusters + for (unsigned int mcId = 0; mcId < nMultiClusters; ++mcId) { + const auto& hits_and_fractions = mClusters[mcId].hitsAndFractions(); + if (!hits_and_fractions.empty()) { + std::unordered_map CPEnergyInMCL; + int maxCPId_byNumberOfHits = -1; + unsigned int maxCPNumberOfHitsInMCL = 0; + int maxCPId_byEnergy = -1; + float maxEnergySharedMCLandCP = 0.f; + float energyFractionOfMCLinCP = 0.f; + float energyFractionOfCPinMCL = 0.f; + + //In case of matched rechit-simhit, so matched + //caloparticle-layercluster-multicluster, we count and save the number of + //recHits related to the maximum energy CaloParticle out of all + //CaloParticles related to that layer cluster and multiCluster. + + std::unordered_map occurrencesCPinMCL; + unsigned int numberOfNoiseHitsInMCL = 0; + unsigned int numberOfHaloHitsInMCL = 0; + unsigned int numberOfHitsInMCL = 0; + + //number of hits related to that cluster + unsigned int numberOfHitsInLC = hits_and_fractions.size(); + numberOfHitsInMCL += numberOfHitsInLC; + std::unordered_map CPEnergyInLC; + + //hitsToCaloParticleId is a vector of ints, one for each recHit of the + //layer cluster under study. If negative, there is no simHit from any CaloParticle related. + //If positive, at least one CaloParticle has been found with matched simHit. + //In more detail: + // 1. hitsToCaloParticleId[hitId] = -3 + // TN: These represent Halo Cells(N) that have not been + // assigned to any CaloParticle (hence the T). + // 2. hitsToCaloParticleId[hitId] = -2 + // FN: There represent Halo Cells(N) that have been assigned + // to a CaloParticle (hence the F, since those should have not been marked as halo) + // 3. hitsToCaloParticleId[hitId] = -1 + // FP: These represent Real Cells(P) that have not been + // assigned to any CaloParticle (hence the F, since these are fakes) + // 4. hitsToCaloParticleId[hitId] >= 0 + // TP There represent Real Cells(P) that have been assigned + // to a CaloParticle (hence the T) + + std::vector hitsToCaloParticleId(numberOfHitsInLC); + //det id of the first hit just to make the lcLayerId variable + //which maps the layers in -z: 0->51 and in +z: 52->103 + const auto firstHitDetId = hits_and_fractions[0].first; + int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) + + layers_ * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; + + //Loop though the hits of the layer cluster under study + for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { + const auto rh_detid = hits_and_fractions[hitId].first; + const auto rhFraction = hits_and_fractions[hitId].second; + + //Since the hit is belonging to the layer cluster, it must also be in the recHits map. + const auto itcheck = hitMap_->find(rh_detid); + const auto hit = itcheck->second; + + //Make a map that will connect a detid (that belongs to a recHit of the layer cluster under study, + //no need to save others) with: + //1. the layer clusters that have recHits in that detid + //2. the fraction of the recHit of each layer cluster that contributes to that detid. + //So, something like: + //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ... + //here comparing with the caloParticle map above + auto hit_find_in_LC = detIdToMultiClusterId_Map.find(rh_detid); + if (hit_find_in_LC == detIdToMultiClusterId_Map.end()) { + detIdToMultiClusterId_Map[rh_detid] = std::vector(); + } + detIdToMultiClusterId_Map[rh_detid].emplace_back(hgcal::detIdInfoInMultiCluster{mcId, mcId, rhFraction}); + + // Check whether the recHit of the layer cluster under study has a sim hit in the same cell + auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); + + // If the fraction is zero or the hit does not belong to any calo + // particle, set the caloParticleId for the hit to -1 and this will + // contribute to the number of noise hits + if (rhFraction == 0.) { // this could be a real hit that has been marked as halo + hitsToCaloParticleId[hitId] = -2; + numberOfHaloHitsInMCL++; + } + if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { + hitsToCaloParticleId[hitId] -= 1; + } else { + auto maxCPEnergyInLC = 0.f; + auto maxCPId = -1; + for (auto& h : hit_find_in_CP->second) { + auto shared_fraction = std::min(rhFraction, h.fraction); + //We are in the case where there are caloParticles with simHits connected via detid with the recHit under study + //So, from all layers clusters, find the recHits that are connected with a caloParticle and save/calculate the + //energy of that caloParticle as the sum over all recHits of the recHits energy weighted + //by the caloParticle's fraction related to that recHit. + CPEnergyInMCL[h.clusterId] += shared_fraction * hit->energy(); + //Same but for layer clusters for the cell association per layer + CPEnergyInLC[h.clusterId] += shared_fraction * hit->energy(); + //Here cPOnLayer[caloparticle][layer] described above is set + //Here for multiClusters with matched recHit, the CP fraction times hit energy is added and saved + cPOnLayer[h.clusterId][lcLayerId].multiClusterIdToEnergyAndScore[mcId].first += + shared_fraction * hit->energy(); + cPOnLayer[h.clusterId][lcLayerId].multiClusterIdToEnergyAndScore[mcId].second = FLT_MAX; + //cpsInMultiCluster[multicluster][CPids] + //Connects a multiCluster with all related caloParticles + cpsInMultiCluster[mcId].emplace_back(h.clusterId, FLT_MAX); + //From all CaloParticles related to a layer cluster, we save id and energy of the caloParticle + //that after simhit-rechit matching in layer has the maximum energy. + if (shared_fraction > maxCPEnergyInLC) { + //energy is used only here. cpid is saved for multiClusters + maxCPEnergyInLC = CPEnergyInLC[h.clusterId]; + maxCPId = h.clusterId; + } + } + //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise. + hitsToCaloParticleId[hitId] = maxCPId; + } + + } //end of loop through recHits of the layer cluster. + + //Loop through all recHits to count how many of them are noise and how many are matched. + //In case of matched rechit-simhit, we count and save the number of recHits related to the maximum energy CaloParticle. + for (auto c : hitsToCaloParticleId) { + if (c < 0) { + numberOfNoiseHitsInMCL++; + } else { + occurrencesCPinMCL[c]++; + } + } + + //Below from all maximum energy CaloParticles, we save the one with the largest amount + //of related recHits. + for (auto& c : occurrencesCPinMCL) { + if (c.second > maxCPNumberOfHitsInMCL) { + maxCPId_byNumberOfHits = c.first; + maxCPNumberOfHitsInMCL = c.second; + } + } + + //Find the CaloParticle that has the maximum energy shared with the multiCluster under study. + for (auto& c : CPEnergyInMCL) { + if (c.second > maxEnergySharedMCLandCP) { + maxCPId_byEnergy = c.first; + maxEnergySharedMCLandCP = c.second; + } + } + //The energy of the CaloParticle that found to have the maximum energy shared with the multiCluster under study. + float totalCPEnergyFromLayerCP = 0.f; + if (maxCPId_byEnergy >= 0) { + //Loop through all layers + for (unsigned int j = 0; j < layers_ * 2; ++j) { + totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; + } + energyFractionOfCPinMCL = maxEnergySharedMCLandCP / totalCPEnergyFromLayerCP; + if (mClusters[mcId].energy() > 0.f) { + energyFractionOfMCLinCP = maxEnergySharedMCLandCP / mClusters[mcId].energy(); + } + } + + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << std::setw(12) << "multiCluster" + << "\t" << std::setw(10) << "mulcl energy" + << "\t" << std::setw(5) << "nhits" + << "\t" << std::setw(12) << "noise hits" + << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" + << "\t" << std::setw(8) << "nhitsCP" + << "\t" << std::setw(16) << "maxCPId_byEnergy" + << "\t" << std::setw(23) << "maxEnergySharedMCLandCP" + << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" + << "\t" << std::setw(22) << "energyFractionOfMCLinCP" + << "\t" << std::setw(25) << "energyFractionOfCPinMCL" + << "\t" << std::endl; + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << std::setw(12) << mcId << "\t" << std::setw(10) << mClusters[mcId].energy() << "\t" << std::setw(5) + << numberOfHitsInMCL << "\t" << std::setw(12) << numberOfNoiseHitsInMCL << "\t" << std::setw(22) + << maxCPId_byNumberOfHits << "\t" << std::setw(8) << maxCPNumberOfHitsInMCL << "\t" << std::setw(16) + << maxCPId_byEnergy << "\t" << std::setw(23) << maxEnergySharedMCLandCP << "\t" << std::setw(22) + << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfMCLinCP << "\t" << std::setw(25) + << energyFractionOfCPinMCL << std::endl; + } + } // end of loop through multiClusters + + // Update cpsInMultiCluster; compute the score MultiCluster-to-CaloParticle, + // together with the returned AssociationMap + for (unsigned int mcId = 0; mcId < nMultiClusters; ++mcId) { + // find the unique caloParticles id contributing to the multilusters + std::sort(cpsInMultiCluster[mcId].begin(), cpsInMultiCluster[mcId].end()); + auto last = std::unique(cpsInMultiCluster[mcId].begin(), cpsInMultiCluster[mcId].end()); + cpsInMultiCluster[mcId].erase(last, cpsInMultiCluster[mcId].end()); + + const auto& hits_and_fractions = mClusters[mcId].hitsAndFractions(); + unsigned int numberOfHitsInLC = hits_and_fractions.size(); + if (numberOfHitsInLC > 0) { + if (mClusters[mcId].energy() == 0. && !cpsInMultiCluster[mcId].empty()) { + //Loop through all CaloParticles contributing to multiCluster mcId. + for (auto& cpPair : cpsInMultiCluster[mcId]) { + //In case of a multiCluster with zero energy but related CaloParticles the score is set to 1. + cpPair.second = 1.; + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << "multiClusterId : \t " << mcId << "\t CP id : \t" << cpPair.first << "\t score \t " << cpPair.second + << "\n"; + } + continue; + } + + // Compute the correct normalization + float invMultiClusterEnergyWeight = 0.f; + for (auto const& haf : mClusters[mcId].hitsAndFractions()) { + invMultiClusterEnergyWeight += + (haf.second * hitMap_->at(haf.first)->energy()) * (haf.second * hitMap_->at(haf.first)->energy()); + } + invMultiClusterEnergyWeight = 1.f / invMultiClusterEnergyWeight; + + for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { + DetId rh_detid = hits_and_fractions[i].first; + float rhFraction = hits_and_fractions[i].second; + + bool hitWithNoCP = (detIdToCaloParticleId_Map.find(rh_detid) == detIdToCaloParticleId_Map.end()); + + auto itcheck = hitMap_->find(rh_detid); + const HGCRecHit* hit = itcheck->second; + float hitEnergyWeight = hit->energy() * hit->energy(); + + for (auto& cpPair : cpsInMultiCluster[mcId]) { + unsigned int multiClusterId = cpPair.first; + float cpFraction = 0.f; + if (!hitWithNoCP) { + auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), + detIdToCaloParticleId_Map[rh_detid].end(), + hgcal::detIdInfoInCluster{multiClusterId, 0.f}); + if (findHitIt != detIdToCaloParticleId_Map[rh_detid].end()) + cpFraction = findHitIt->fraction; + } + if (cpPair.second == FLT_MAX) { + cpPair.second = 0.f; + } + cpPair.second += + (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invMultiClusterEnergyWeight; + } + } // End of loop over Hits within a MultiCluster +#ifdef EDM_ML_DEBUG + //In case of a multiCluster with some energy but none related CaloParticles print some info. + if (cpsInMultiCluster[mcId].empty()) + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") << "multiCluster Id: \t" << mcId << "\tCP id:\t-1 " + << "\t score \t-1" + << "\n"; +#endif + } + } // End of loop over MultiClusters + + // Compute the CaloParticle-To-MultiCluster score + for (const auto& cpId : cPSelectedIndices) { + for (unsigned int layerId = 0; layerId < layers_ * 2; ++layerId) { + unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size(); + if (CPNumberOfHits == 0) + continue; +#ifdef EDM_ML_DEBUG + int mcWithMaxEnergyInCP = -1; + float maxEnergyMCLperlayerinCP = 0.f; + float CPenergy = cPOnLayer[cpId][layerId].energy; + float CPEnergyFractionInMCLperlayer = 0.f; + for (auto& mc : cPOnLayer[cpId][layerId].multiClusterIdToEnergyAndScore) { + if (mc.second.first > maxEnergyMCLperlayerinCP) { + maxEnergyMCLperlayerinCP = mc.second.first; + mcWithMaxEnergyInCP = mc.first; + } + } + if (CPenergy > 0.f) + CPEnergyFractionInMCLperlayer = maxEnergyMCLperlayerinCP / CPenergy; + + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t" + << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) << "CPNhitsOnLayer\t" << std::setw(18) + << "mcWithMaxEnergyInCP\t" << std::setw(15) << "maxEnergyMCLinCP\t" << std::setw(20) + << "CPEnergyFractionInMCL" + << "\n"; + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) + << caloParticles[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) + << CPNumberOfHits << "\t" << std::setw(18) << mcWithMaxEnergyInCP << "\t" << std::setw(15) + << maxEnergyMCLperlayerinCP << "\t" << std::setw(20) << CPEnergyFractionInMCLperlayer << "\n"; +#endif + + for (unsigned int i = 0; i < CPNumberOfHits; ++i) { + auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[i].first; + auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[i].second; + + bool hitWithNoMCL = false; + if (cpFraction == 0.f) + continue; //hopefully this should never happen + auto hit_find_in_MCL = detIdToMultiClusterId_Map.find(cp_hitDetId); + if (hit_find_in_MCL == detIdToMultiClusterId_Map.end()) + hitWithNoMCL = true; + auto itcheck = hitMap_->find(cp_hitDetId); + const HGCRecHit* hit = itcheck->second; + float hitEnergyWeight = hit->energy() * hit->energy(); + for (auto& mcPair : cPOnLayer[cpId][layerId].multiClusterIdToEnergyAndScore) { + unsigned int multiClusterId = mcPair.first; + float mcFraction = 0.f; + + if (!hitWithNoMCL) { + auto findHitIt = std::find(detIdToMultiClusterId_Map[cp_hitDetId].begin(), + detIdToMultiClusterId_Map[cp_hitDetId].end(), + hgcal::detIdInfoInMultiCluster{multiClusterId, 0, 0.f}); + if (findHitIt != detIdToMultiClusterId_Map[cp_hitDetId].end()) + mcFraction = findHitIt->fraction; + } + //Observe here that we do not divide as before by the layer cluster energy weight. We should sum first + //over all layers and divide with the total CP energy over all layers. + if (mcPair.second.second == FLT_MAX) { + mcPair.second.second = 0.f; + } + mcPair.second.second += (mcFraction - cpFraction) * (mcFraction - cpFraction) * hitEnergyWeight; +#ifdef EDM_ML_DEBUG + LogDebug("HGCalValidator") << "multiClusterId:\t" << multiClusterId << "\tmcfraction,cpfraction:\t" + << mcFraction << ", " << cpFraction << "\thitEnergyWeight:\t" << hitEnergyWeight + << "\tcurrent score numerator:\t" << mcPair.second.second << "\n"; +#endif + } // End of loop over MultiClusters linked to hits of this CaloParticle + } // End of loop over hits of CaloParticle on a Layer +#ifdef EDM_ML_DEBUG + if (cPOnLayer[cpId][layerId].multiClusterIdToEnergyAndScore.empty()) + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id:\t-1 " + << "\t layer \t " << layerId << " Sub score in \t -1" + << "\n"; + +#endif + } + } + return {cpsInMultiCluster, cPOnLayer}; +} + +hgcal::RecoToSimCollectionWithMultiClusters MultiClusterAssociatorByEnergyScoreImpl::associateRecoToSim( + const edm::Handle& mCCH, const edm::Handle& cPCH) const { + hgcal::RecoToSimCollectionWithMultiClusters returnValue(productGetter_); + const auto& links = makeConnections(mCCH, cPCH); + + const auto& cpsInMultiCluster = std::get<0>(links); + for (size_t mcId = 0; mcId < cpsInMultiCluster.size(); ++mcId) { + for (auto& cpPair : cpsInMultiCluster[mcId]) { + LogDebug("MultiClusterAssociatorByEnergyScoreImpl") + << "multiCluster Id: \t" << mcId << "\t CP id: \t" << cpPair.first << "\t score \t" << cpPair.second << "\n"; + // Fill AssociationMap + returnValue.insert(edm::Ref(mCCH, mcId), // Ref to MC + std::make_pair(edm::Ref(cPCH, cpPair.first), + cpPair.second) // Pair + ); + } + } + return returnValue; +} + +hgcal::SimToRecoCollectionWithMultiClusters MultiClusterAssociatorByEnergyScoreImpl::associateSimToReco( + const edm::Handle& mCCH, const edm::Handle& cPCH) const { + hgcal::SimToRecoCollectionWithMultiClusters returnValue(productGetter_); + const auto& links = makeConnections(mCCH, cPCH); + const auto& cPOnLayer = std::get<1>(links); + for (size_t cpId = 0; cpId < cPOnLayer.size(); ++cpId) { + for (size_t layerId = 0; layerId < cPOnLayer[cpId].size(); ++layerId) { + for (auto& mcPair : cPOnLayer[cpId][layerId].multiClusterIdToEnergyAndScore) { + returnValue.insert( + edm::Ref(cPCH, cpId), // Ref to CP + std::make_pair(edm::Ref(mCCH, mcPair.first), // Pair > + ); + } + } + } + return returnValue; +} diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.h new file mode 100644 index 0000000000000..c30f7190f0b0e --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreImpl.h @@ -0,0 +1,70 @@ +// Original Author: Leonardo Cristella + +#include +#include +#include +#include // shared_ptr + +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HGCRecHit/interface/HGCRecHit.h" +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +namespace edm { + class EDProductGetter; +} + +namespace hgcal { + struct detIdInfoInCluster { + bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; + long unsigned int clusterId; + float fraction; + detIdInfoInCluster(long unsigned int cId, float fr) { + clusterId = cId; + fraction = fr; + } + }; + + struct detIdInfoInMultiCluster { + bool operator==(const detIdInfoInMultiCluster &o) const { return multiclusterId == o.multiclusterId; }; + unsigned int multiclusterId; + long unsigned int clusterId; + float fraction; + }; + + struct caloParticleOnLayer { + unsigned int caloParticleId; + float energy = 0; + std::vector> hits_and_fractions; + std::unordered_map> multiClusterIdToEnergyAndScore; + }; + + typedef std::vector>> multiClusterToCaloParticle; + typedef std::vector> caloParticleToMultiCluster; + typedef std::tuple association; +} // namespace hgcal + +class MultiClusterAssociatorByEnergyScoreImpl : public hgcal::MultiClusterToCaloParticleAssociatorBaseImpl { +public: + explicit MultiClusterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + bool, + std::shared_ptr, + const std::unordered_map *&); + + hgcal::RecoToSimCollectionWithMultiClusters associateRecoToSim( + const edm::Handle &mCCH, + const edm::Handle &cPCH) const override; + + hgcal::SimToRecoCollectionWithMultiClusters associateSimToReco( + const edm::Handle &mCCH, + const edm::Handle &cPCH) const override; + +private: + const bool hardScatterOnly_; + std::shared_ptr recHitTools_; + const std::unordered_map *hitMap_; + unsigned layers_; + edm::EDProductGetter const *productGetter_; + hgcal::association makeConnections(const edm::Handle &mCCH, + const edm::Handle &cPCH) const; +}; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreProducer.cc new file mode 100644 index 0000000000000..b0ffb0ce9f8b6 --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/MultiClusterAssociatorByEnergyScoreProducer.cc @@ -0,0 +1,67 @@ +// Original author: Leonardo Cristella + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h" +#include "MultiClusterAssociatorByEnergyScoreImpl.h" + +class MultiClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +public: + explicit MultiClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~MultiClusterAssociatorByEnergyScoreProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; + edm::EDGetTokenT> hitMap_; + edm::ESGetToken caloGeometry_; + const bool hardScatterOnly_; + std::shared_ptr rhtools_; +}; + +MultiClusterAssociatorByEnergyScoreProducer::MultiClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) + : hitMap_(consumes>(ps.getParameter("hitMapTag"))), + caloGeometry_(esConsumes()), + hardScatterOnly_(ps.getParameter("hardScatterOnly")) { + rhtools_.reset(new hgcal::RecHitTools()); + + // Register the product + produces(); +} + +MultiClusterAssociatorByEnergyScoreProducer::~MultiClusterAssociatorByEnergyScoreProducer() {} + +void MultiClusterAssociatorByEnergyScoreProducer::produce(edm::StreamID, + edm::Event &iEvent, + const edm::EventSetup &es) const { + edm::ESHandle geom = es.getHandle(caloGeometry_); + rhtools_->setGeometry(*geom); + + const std::unordered_map *hitMap = &iEvent.get(hitMap_); + + auto impl = std::make_unique( + iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); + auto toPut = std::make_unique(std::move(impl)); + iEvent.put(std::move(toPut)); +} + +void MultiClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { + edm::ParameterSetDescription desc; + desc.add("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); + desc.add("hardScatterOnly", true); + + cfg.add("multiClusterAssociatorByEnergyScore", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(MultiClusterAssociatorByEnergyScoreProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc new file mode 100644 index 0000000000000..6c78e2e6cfe5f --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc @@ -0,0 +1,533 @@ +#include "TracksterAssociatorByEnergyScoreImpl.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" + +TracksterAssociatorByEnergyScoreImpl::TracksterAssociatorByEnergyScoreImpl( + edm::EDProductGetter const& productGetter, + bool hardScatterOnly, + std::shared_ptr recHitTools, + const std::unordered_map* hitMap) + : hardScatterOnly_(hardScatterOnly), recHitTools_(recHitTools), hitMap_(hitMap), productGetter_(&productGetter) { + layers_ = recHitTools_->lastLayerBH(); +} + +hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( + const edm::Handle& tCH, + const edm::Handle& lCCH, + const edm::Handle& sCCH) const { + // Get collections + const auto& tracksters = *tCH.product(); + const auto& layerClusters = *lCCH.product(); + const auto& simClusters = *sCCH.product(); + auto nTracksters = tracksters.size(); + + //There shouldn't be any SimTracks from different crossings, but maybe they will be added later. + //At the moment there should be one SimTrack in each SimCluster. + auto nSimClusters = simClusters.size(); + std::vector sCIndices; + for (unsigned int scId = 0; scId < nSimClusters; ++scId) { + if (hardScatterOnly_ && (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or + simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "Excluding SimCluster from event: " << simClusters[scId].g4Tracks()[0].eventId().event() + << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; + continue; + } + sCIndices.emplace_back(scId); + } + nSimClusters = sCIndices.size(); + + // Initialize tssInSimCluster. To be returned outside, since it contains the + // information to compute the SimCluster-To-Trackster score. + // tssInSimCluster[scId]: + hgcal::simClusterToTrackster tssInSimCluster; + tssInSimCluster.resize(nSimClusters); + for (unsigned int i = 0; i < nSimClusters; ++i) { + tssInSimCluster[i].simClusterId = i; + tssInSimCluster[i].energy = 0.f; + tssInSimCluster[i].hits_and_fractions.clear(); + } + + // Fill detIdToSimClusterId_Map and update tssInSimCluster + std::unordered_map> detIdToSimClusterId_Map; + for (const auto& scId : sCIndices) { + const auto& hits_and_fractions = simClusters[scId].hits_and_fractions(); + for (const auto& it_haf : hits_and_fractions) { + const auto hitid = it_haf.first; + const auto itcheck = hitMap_->find(hitid); + if (itcheck != hitMap_->end()) { + const auto hit_find_it = detIdToSimClusterId_Map.find(hitid); + if (hit_find_it == detIdToSimClusterId_Map.end()) { + detIdToSimClusterId_Map[hitid] = std::vector(); + } + detIdToSimClusterId_Map[hitid].emplace_back(scId, it_haf.second); + + const HGCRecHit* hit = itcheck->second; + tssInSimCluster[scId].energy += it_haf.second * hit->energy(); + tssInSimCluster[scId].hits_and_fractions.emplace_back(hitid, it_haf.second); + } + } + } // end of loop over SimClusters + +#ifdef EDM_ML_DEBUG + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "tssInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; + for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " Energy: " << tssInSimCluster[sc].energy << std::endl; + LogDebug("TracksterAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; + double tot_energy = 0.; + for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + << haf.second * hitMap_->at(haf.first)->energy() << std::endl; + tot_energy += haf.second * hitMap_->at(haf.first)->energy(); + } + LogDebug("TracksterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; + } + } + + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; + for (auto const& detId : detIdToSimClusterId_Map) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "For detId: " << (uint32_t)detId.first + << " we have found the following connections with SimClusters:" << std::endl; + for (auto const& sc : detId.second) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " SimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction + << " and energy: " << sc.fraction * hitMap_->at(detId.first)->energy() << std::endl; + } + } +#endif + + // Fill detIdToLayerClusterId_Map and scsInTrackster; update tssInSimCluster + std::unordered_map> detIdToLayerClusterId_Map; + // this contains the ids of the simclusters contributing with at least one + // hit to the Trackster. To be returned since this contains the information + // to compute the Trackster-To-SimCluster score. + hgcal::tracksterToSimCluster scsInTrackster; //[tsId][scId]->(energy,score) + scsInTrackster.resize(nTracksters); + + for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { + for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { + const auto lcId = tracksters[tsId].vertices(i); + const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); + + const std::vector>& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + unsigned int numberOfHitsInLC = hits_and_fractions.size(); + + for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { + const auto rh_detid = hits_and_fractions[hitId].first; + const auto rhFraction = hits_and_fractions[hitId].second; + + const auto hit_find_in_LC = detIdToLayerClusterId_Map.find(rh_detid); + if (hit_find_in_LC == detIdToLayerClusterId_Map.end()) { + detIdToLayerClusterId_Map[rh_detid] = std::vector(); + } + detIdToLayerClusterId_Map[rh_detid].emplace_back(lcId, rhFraction); + + const auto hit_find_in_SC = detIdToSimClusterId_Map.find(rh_detid); + + if (hit_find_in_SC != detIdToSimClusterId_Map.end()) { + const auto itcheck = hitMap_->find(rh_detid); + const HGCRecHit* hit = itcheck->second; + //Loops through all the simclusters that have the layer cluster rechit under study + //Here is time to update the tssInSimCluster and connect the SimCluster with all + //the Tracksters that have the current rechit detid matched. + for (const auto& h : hit_find_in_SC->second) { + //tssInSimCluster[simclusterId][layerclusterId]-> (energy,score) + //SC_i - > TS_j, TS_k, ... + tssInSimCluster[h.clusterId].tracksterIdToEnergyAndScore[tsId].first += + lcFractionInTs * h.fraction * hit->energy(); + //TS_i -> SC_j, SC_k, ... + scsInTrackster[tsId].emplace_back(h.clusterId, 0.f); + } + } + } // End loop over hits on a LayerCluster + } // End loop over LayerClusters in Trackster + } // End of loop over Tracksters + +#ifdef EDM_ML_DEBUG + for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { + for (const auto& lcId : tracksters[tsId].vertices()) { + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + unsigned int numberOfHitsInLC = hits_and_fractions.size(); + + // This vector will store, for each hit in the Layercluster, the index of + // the SimCluster that contributed the most, in terms of energy, to it. + // Special values are: + // + // -2 --> the reconstruction fraction of the RecHit is 0 (used in the past to monitor Halo Hits) + // -3 --> same as before with the added condition that no SimCluster has been linked to this RecHit + // -1 --> the reco fraction is >0, but no SimCluster has been linked to it + // >=0 --> index of the linked SimCluster + std::vector hitsToSimClusterId(numberOfHitsInLC); + // This will store the index of the SimCluster linked to the LayerCluster that has the largest number of hits in common. + int maxSCId_byNumberOfHits = -1; + // This will store the maximum number of shared hits between a LayerCluster and a SimCluster + unsigned int maxSCNumberOfHitsInLC = 0; + // This will store the index of the SimCluster linked to the LayerCluster that has the largest energy in common. + int maxSCId_byEnergy = -1; + // This will store the maximum number of shared energy between a LayerCluster and a SimCluster + float maxEnergySharedLCandSC = 0.f; + // This will store the fraction of the LayerCluster energy shared with the best(energy) SimCluster: e_shared/lc_energy + float energyFractionOfLCinSC = 0.f; + // This will store the fraction of the SimCluster energy shared with the Trackster: e_shared/sc_energy + float energyFractionOfSCinLC = 0.f; + std::unordered_map occurrencesSCinLC; + unsigned int numberOfNoiseHitsInLC = 0; + std::unordered_map SCEnergyInLC; + + for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { + const auto rh_detid = hits_and_fractions[hitId].first; + const auto rhFraction = hits_and_fractions[hitId].second; + + const auto hit_find_in_SC = detIdToSimClusterId_Map.find(rh_detid); + + // if the fraction is zero or the hit does not belong to any SimCluster, + // set the SimCluster Id for the hit to -1; this will + // contribute to the number of noise hits + + // MR Remove the case in which the fraction is 0, since this could be a + // real hit that has been marked as halo. + if (rhFraction == 0.) { + hitsToSimClusterId[hitId] = -2; + } + //Now check if there are SimClusters linked to this rechit of the layercluster + if (hit_find_in_SC == detIdToSimClusterId_Map.end()) { + hitsToSimClusterId[hitId] -= 1; + } else { + const auto itcheck = hitMap_->find(rh_detid); + const HGCRecHit* hit = itcheck->second; + auto maxSCEnergyInLC = 0.f; + auto maxSCId = -1; + //Loop through all the linked SimClusters + for (const auto& h : hit_find_in_SC->second) { + SCEnergyInLC[h.clusterId] += h.fraction * hit->energy(); + // Keep track of which SimCluster contributed the most, in terms + // of energy, to this specific Layer Cluster. + if (SCEnergyInLC[h.clusterId] > maxSCEnergyInLC) { + maxSCEnergyInLC = SCEnergyInLC[h.clusterId]; + maxSCId = h.clusterId; + } + } + hitsToSimClusterId[hitId] = maxSCId; + } + } // End loop over hits on a LayerCluster + + for (const auto& c : hitsToSimClusterId) { + if (c < 0) { + numberOfNoiseHitsInLC++; + } else { + occurrencesSCinLC[c]++; + } + } + + for (const auto& c : occurrencesSCinLC) { + if (c.second > maxSCNumberOfHitsInLC) { + maxSCId_byNumberOfHits = c.first; + maxSCNumberOfHitsInLC = c.second; + } + } + + for (const auto& c : SCEnergyInLC) { + if (c.second > maxEnergySharedLCandSC) { + maxSCId_byEnergy = c.first; + maxEnergySharedLCandSC = c.second; + } + } + + float totalSCEnergyOnLayer = 0.f; + if (maxSCId_byEnergy >= 0) { + totalSCEnergyOnLayer = tssInSimCluster[maxSCId_byEnergy].energy; + energyFractionOfSCinLC = maxEnergySharedLCandSC / totalSCEnergyOnLayer; + if (tracksters[tsId].raw_energy() > 0.f) { + energyFractionOfLCinSC = maxEnergySharedLCandSC / tracksters[tsId].raw_energy(); + } + } + + LogDebug("TracksterAssociatorByEnergyScoreImpl") << std::setw(12) << "TracksterID:" + << "\t" << std::setw(12) << "layerCluster" + << "\t" << std::setw(10) << "lc energy" + << "\t" << std::setw(5) << "nhits" + << "\t" << std::setw(12) << "noise hits" + << "\t" << std::setw(22) << "maxSCId_byNumberOfHits" + << "\t" << std::setw(8) << "nhitsSC" + << "\t" << std::setw(13) << "maxSCId_byEnergy" + << "\t" << std::setw(20) << "maxEnergySharedLCandSC" + << "\t" << std::setw(22) << "totalSCEnergyOnLayer" + << "\t" << std::setw(22) << "energyFractionOfLCinSC" + << "\t" << std::setw(25) << "energyFractionOfSCinLC" + << "\t" + << "\n"; + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << std::setw(12) << tsId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) + << tracksters[tsId].raw_energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) + << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxSCId_byNumberOfHits << "\t" << std::setw(8) + << maxSCNumberOfHitsInLC << "\t" << std::setw(13) << maxSCId_byEnergy << "\t" << std::setw(20) + << maxEnergySharedLCandSC << "\t" << std::setw(22) << totalSCEnergyOnLayer << "\t" << std::setw(22) + << energyFractionOfLCinSC << "\t" << std::setw(25) << energyFractionOfSCinLC << "\n"; + } // End of loop over LayerClusters in Trackster + } // End of loop over Tracksters + + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "Improved tssInSimCluster INFO (Now containing the linked tracksters id and energy - score still empty)" + << std::endl; + for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " Energy: " << tssInSimCluster[sc].energy << std::endl; + double tot_energy = 0.; + for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + << haf.second * hitMap_->at(haf.first)->energy() << std::endl; + tot_energy += haf.second * hitMap_->at(haf.first)->energy(); + } + LogDebug("TracksterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; + } + } + + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; + for (auto const& sc : detIdToSimClusterId_Map) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "For detId: " << (uint32_t)sc.first + << " we have found the following connections with SimClusters:" << std::endl; + for (auto const& sclu : sc.second) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction + << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; + } + } +#endif + + // Update scsInTrackster; compute the score Trackster-to-SimCluster, + // together with the returned AssociationMap + for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { + // The SimClusters contributing to the Trackster's LayerClusters should already be unique. + // find the unique SimClusters id contributing to the Trackster's LayerClusters + std::sort(scsInTrackster[tsId].begin(), scsInTrackster[tsId].end()); + auto last = std::unique(scsInTrackster[tsId].begin(), scsInTrackster[tsId].end()); + scsInTrackster[tsId].erase(last, scsInTrackster[tsId].end()); + + // If a reconstructed Trackster has energy 0 but is linked to a + // SimCluster, assigned score 1 + if (tracksters[tsId].raw_energy() == 0. && !scsInTrackster[tsId].empty()) { + for (auto& scPair : scsInTrackster[tsId]) { + scPair.second = 1.; + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "TracksterId : \t " << tsId << "\t SC id : \t" + << scPair.first << "\t score \t " << scPair.second << "\n"; + } + continue; + } + + float invTracksterEnergyWeight = 0.f; + for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { + const auto lcId = tracksters[tsId].vertices(i); + const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); + + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + // Compute the correct normalization + for (auto const& haf : hits_and_fractions) { + invTracksterEnergyWeight += (lcFractionInTs * haf.second * hitMap_->at(haf.first)->energy()) * + (lcFractionInTs * haf.second * hitMap_->at(haf.first)->energy()); + } + } + invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; + + for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { + const auto lcId = tracksters[tsId].vertices(i); + const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); + + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + unsigned int numberOfHitsInLC = hits_and_fractions.size(); + for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { + DetId rh_detid = hits_and_fractions[i].first; + float rhFraction = hits_and_fractions[i].second * lcFractionInTs; + + const bool hitWithSC = (detIdToSimClusterId_Map.find(rh_detid) != detIdToSimClusterId_Map.end()); + + const auto itcheck = hitMap_->find(rh_detid); + const HGCRecHit* hit = itcheck->second; + float hitEnergyWeight = hit->energy() * hit->energy(); + + for (auto& scPair : scsInTrackster[tsId]) { + float scFraction = 0.f; + if (hitWithSC) { + const auto findHitIt = std::find(detIdToSimClusterId_Map[rh_detid].begin(), + detIdToSimClusterId_Map[rh_detid].end(), + hgcal::detIdInfoInCluster{scPair.first, 0.f}); + if (findHitIt != detIdToSimClusterId_Map[rh_detid].end()) + scFraction = findHitIt->fraction; + } + scPair.second += + (rhFraction - scFraction) * (rhFraction - scFraction) * hitEnergyWeight * invTracksterEnergyWeight; +#ifdef EDM_ML_DEBUG + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "rh_detid:\t" << (uint32_t)rh_detid << "\ttracksterId:\t" << tsId << "\t" + << "rhfraction,scFraction:\t" << rhFraction << ", " << scFraction << "\t" + << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" + << "current score:\t" << scPair.second << "\t" + << "invTracksterEnergyWeight:\t" << invTracksterEnergyWeight << "\n"; +#endif + } + } // End of loop over Hits within a LayerCluster + } // End of loop over LayerClusters in Trackster + +#ifdef EDM_ML_DEBUG + if (scsInTrackster[tsId].empty()) + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "trackster Id: \t" << tsId << "\tSC id:\t-1 " + << "\t score \t-1" + << "\n"; +#endif + } // End of loop over Tracksters + + // Compute the SimCluster-To-Trackster score + for (const auto& scId : sCIndices) { + float invSCEnergyWeight = 0.f; + + const unsigned int SCNumberOfHits = tssInSimCluster[scId].hits_and_fractions.size(); + if (SCNumberOfHits == 0) + continue; +#ifdef EDM_ML_DEBUG + int tsWithMaxEnergyInSC = -1; + //energy of the most energetic TS from all that were linked to SC + float maxEnergyTSinSC = 0.f; + float SCenergy = tssInSimCluster[scId].energy; + //most energetic TS from all TSs linked to SC over SC energy. + float SCEnergyFractionInTS = 0.f; + for (const auto& ts : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { + if (ts.second.first > maxEnergyTSinSC) { + maxEnergyTSinSC = ts.second.first; + tsWithMaxEnergyInSC = ts.first; + } + } + if (SCenergy > 0.f) + SCEnergyFractionInTS = maxEnergyTSinSC / SCenergy; + + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << std::setw(12) << "simcluster\t" << std::setw(15) << "sc total energy\t" << std::setw(15) + << "scEnergyOnLayer\t" << std::setw(14) << "SCNhitsOnLayer\t" << std::setw(18) << "tsWithMaxEnergyInSC\t" + << std::setw(15) << "maxEnergyTSinSC\t" << std::setw(20) << "SCEnergyFractionInTS" + << "\n"; + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << std::setw(12) << scId << "\t" << std::setw(15) << simClusters[scId].energy() << "\t" << std::setw(15) + << SCenergy << "\t" << std::setw(14) << SCNumberOfHits << "\t" << std::setw(18) << tsWithMaxEnergyInSC << "\t" + << std::setw(15) << maxEnergyTSinSC << "\t" << std::setw(20) << SCEnergyFractionInTS << "\n"; +#endif + // Compute the correct normalization + for (auto const& haf : tssInSimCluster[scId].hits_and_fractions) { + invSCEnergyWeight += std::pow(haf.second * hitMap_->at(haf.first)->energy(), 2); + } + invSCEnergyWeight = 1.f / invSCEnergyWeight; + + for (unsigned int i = 0; i < SCNumberOfHits; ++i) { + auto& sc_hitDetId = tssInSimCluster[scId].hits_and_fractions[i].first; + auto& scFraction = tssInSimCluster[scId].hits_and_fractions[i].second; + + bool hitWithLC = false; + if (scFraction == 0.f) + continue; // hopefully this should never happen + const auto hit_find_in_LC = detIdToLayerClusterId_Map.find(sc_hitDetId); + if (hit_find_in_LC != detIdToLayerClusterId_Map.end()) + hitWithLC = true; + const auto itcheck = hitMap_->find(sc_hitDetId); + const HGCRecHit* hit = itcheck->second; + float hitEnergyWeight = hit->energy() * hit->energy(); + for (auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { + unsigned int tsId = tsPair.first; + float tsFraction = 0.f; + + for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { + const auto lcId = tracksters[tsId].vertices(i); + const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); + + if (hitWithLC) { + const auto findHitIt = std::find(detIdToLayerClusterId_Map[sc_hitDetId].begin(), + detIdToLayerClusterId_Map[sc_hitDetId].end(), + hgcal::detIdInfoInCluster{lcId, 0.f}); + if (findHitIt != detIdToLayerClusterId_Map[sc_hitDetId].end()) + tsFraction = findHitIt->fraction * lcFractionInTs; + } + tsPair.second.second += + (tsFraction - scFraction) * (tsFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; +#ifdef EDM_ML_DEBUG + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tracksterId << "\t" + << "tsFraction, scFraction:\t" << tsFraction << ", " << scFraction << "\t" + << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" + << "current score:\t" << tsPair.second.second << "\t" + << "invSCEnergyWeight:\t" << invSCEnergyWeight << "\n"; +#endif + } // End of loop over Trackster's LayerClusters + } // End of loop over Tracksters linked to hits of this SimCluster + } // End of loop over hits of SimCluster on a Layer +#ifdef EDM_ML_DEBUG + if (tssInSimCluster[scId].tracksterIdToEnergyAndScore.empty()) + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tTS id:\t-1 " + << "\t score \t-1" + << "\n"; + + for (const auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") + << "SC Id: \t" << scId << "\t TS id: \t" << tsPair.first << "\t score \t" << tsPair.second.second + << "\t shared energy:\t" << tsPair.second.first << "\t shared energy fraction:\t" + << (tsPair.second.first / SCenergy) << "\n"; + } +#endif + } // End loop over SimCluster indices + return {scsInTrackster, tssInSimCluster}; +} + +hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::associateRecoToSim( + const edm::Handle& tCH, + const edm::Handle& lCCH, + const edm::Handle& sCCH) const { + hgcal::RecoToSimCollectionTracksters returnValue(productGetter_); + const auto& links = makeConnections(tCH, lCCH, sCCH); + + const auto& scsInTrackster = std::get<0>(links); + for (size_t tsId = 0; tsId < scsInTrackster.size(); ++tsId) { + for (auto& scPair : scsInTrackster[tsId]) { + LogDebug("TracksterAssociatorByEnergyScoreImpl") << "Trackster Id: \t" << tsId << "\t SimCluster id: \t" + << scPair.first << "\t score \t" << scPair.second << "\n"; + // Fill AssociationMap + returnValue.insert(edm::Ref(tCH, tsId), // Ref to TS + std::make_pair(edm::Ref(sCCH, scPair.first), + scPair.second) // Pair + ); + } + } + return returnValue; +} + +hgcal::SimToRecoCollectionTracksters TracksterAssociatorByEnergyScoreImpl::associateSimToReco( + const edm::Handle& tCH, + const edm::Handle& lCCH, + const edm::Handle& sCCH) const { + hgcal::SimToRecoCollectionTracksters returnValue(productGetter_); + const auto& links = makeConnections(tCH, lCCH, sCCH); + const auto& tssInSimCluster = std::get<1>(links); + for (size_t scId = 0; scId < tssInSimCluster.size(); ++scId) { + for (auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { + returnValue.insert( + edm::Ref(sCCH, scId), // Ref to SC + std::make_pair(edm::Ref(tCH, tsPair.first), // Pair > + ); + } + } + return returnValue; +} diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h new file mode 100644 index 0000000000000..8c75d5af38797 --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h @@ -0,0 +1,64 @@ +// Original Author: Leonardo Cristella + +#include +#include +#include +#include // shared_ptr + +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HGCRecHit/interface/HGCRecHit.h" +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +namespace edm { + class EDProductGetter; +} + +namespace hgcal { + struct detIdInfoInCluster { + bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; + long unsigned int clusterId; + float fraction; + detIdInfoInCluster(long unsigned int cId, float fr) { + clusterId = cId; + fraction = fr; + } + }; + + struct simClusterOnLayer { + unsigned int simClusterId; + float energy = 0; + std::vector> hits_and_fractions; + std::unordered_map> tracksterIdToEnergyAndScore; + }; + + typedef std::vector>> tracksterToSimCluster; + typedef std::vector simClusterToTrackster; + typedef std::tuple association; +} // namespace hgcal + +class TracksterAssociatorByEnergyScoreImpl : public hgcal::TracksterToSimClusterAssociatorBaseImpl { +public: + explicit TracksterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + bool, + std::shared_ptr, + const std::unordered_map *); + + hgcal::RecoToSimCollectionTracksters associateRecoToSim(const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const override; + + hgcal::SimToRecoCollectionTracksters associateSimToReco(const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const override; + +private: + const bool hardScatterOnly_; + std::shared_ptr recHitTools_; + const std::unordered_map *hitMap_; + unsigned layers_; + edm::EDProductGetter const *productGetter_; + hgcal::association makeConnections(const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const; +}; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc new file mode 100644 index 0000000000000..8bd086a89574d --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc @@ -0,0 +1,67 @@ +// Original author: Leonardo Cristella + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" +#include "TracksterAssociatorByEnergyScoreImpl.h" + +class TracksterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +public: + explicit TracksterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~TracksterAssociatorByEnergyScoreProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; + edm::EDGetTokenT> hitMap_; + edm::ESGetToken caloGeometry_; + const bool hardScatterOnly_; + std::shared_ptr rhtools_; +}; + +TracksterAssociatorByEnergyScoreProducer::TracksterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) + : hitMap_(consumes>(ps.getParameter("hitMapTag"))), + caloGeometry_(esConsumes()), + hardScatterOnly_(ps.getParameter("hardScatterOnly")) { + rhtools_.reset(new hgcal::RecHitTools()); + + // Register the product + produces(); +} + +TracksterAssociatorByEnergyScoreProducer::~TracksterAssociatorByEnergyScoreProducer() {} + +void TracksterAssociatorByEnergyScoreProducer::produce(edm::StreamID, + edm::Event &iEvent, + const edm::EventSetup &es) const { + edm::ESHandle geom = es.getHandle(caloGeometry_); + rhtools_->setGeometry(*geom); + + const std::unordered_map *hitMap = &iEvent.get(hitMap_); + + auto impl = std::make_unique( + iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); + auto toPut = std::make_unique(std::move(impl)); + iEvent.put(std::move(toPut)); +} + +void TracksterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { + edm::ParameterSetDescription desc; + desc.add("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); + desc.add("hardScatterOnly", true); + + cfg.add("tracksterAssociatorByEnergyScore", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(TracksterAssociatorByEnergyScoreProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py new file mode 100644 index 0000000000000..7e82345bfa585 --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py @@ -0,0 +1,12 @@ +import FWCore.ParameterSet.Config as cms + +multiClusterCaloParticleAssociation = cms.EDProducer("MCToCPAssociatorEDProducer", + associator = cms.InputTag('mcAssocByEnergyScoreProducer'), + label_cp = cms.InputTag("mix","MergedCaloTruth"), + label_mcl = cms.InputTag("ticlMultiClustersFromTrackstersMerge") +) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(multiClusterCaloParticleAssociation, + label_cp = "mixData:MergedCaloTruth" +) diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py new file mode 100644 index 0000000000000..fe5b6a498740a --- /dev/null +++ b/SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +tracksterSimClusterAssociation = cms.EDProducer("TSToSCAssociatorEDProducer", + associator = cms.InputTag('tsAssocByEnergyScoreProducer'), + label_scl = cms.InputTag("mix","MergedCaloTruth"), + label_tst = cms.InputTag("ticlTrackstersMerge"), + label_lcl = cms.InputTag("hgcalLayerClusters") +) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(tracksterSimClusterAssociation, + label_scl = "mixData:MergedCaloTruth" +) diff --git a/SimDataFormats/Associations/BuildFile.xml b/SimDataFormats/Associations/BuildFile.xml index f060052c1bfd0..9c5fd58c2db6d 100644 --- a/SimDataFormats/Associations/BuildFile.xml +++ b/SimDataFormats/Associations/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h b/SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h index a5509353f22a8..094db05e3ba5d 100644 --- a/SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h +++ b/SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h @@ -19,8 +19,11 @@ namespace hgcal { LayerClusterToSimClusterAssociator() = default; LayerClusterToSimClusterAssociator(LayerClusterToSimClusterAssociator &&) = default; LayerClusterToSimClusterAssociator &operator=(LayerClusterToSimClusterAssociator &&) = default; - ~LayerClusterToSimClusterAssociator() = default; + LayerClusterToSimClusterAssociator(const LayerClusterToSimClusterAssociator &) = delete; // stop default + ~LayerClusterToSimClusterAssociator() = default; + const LayerClusterToSimClusterAssociator &operator=(const LayerClusterToSimClusterAssociator &) = + delete; // stop default // ---------- const member functions --------------------- /// Associate a LayerCluster to SimClusters hgcal::RecoToSimCollectionWithSimClusters associateRecoToSim(const edm::Handle &cCCH, @@ -35,11 +38,6 @@ namespace hgcal { } private: - LayerClusterToSimClusterAssociator(const LayerClusterToSimClusterAssociator &) = delete; // stop default - - const LayerClusterToSimClusterAssociator &operator=(const LayerClusterToSimClusterAssociator &) = - delete; // stop default - // ---------- member data -------------------------------- std::unique_ptr m_impl; }; diff --git a/SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h b/SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h new file mode 100644 index 0000000000000..6e9979ace3814 --- /dev/null +++ b/SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h @@ -0,0 +1,50 @@ +#ifndef SimDataFormats_Associations_MultiClusterToCaloParticleAssociator_h +#define SimDataFormats_Associations_MultiClusterToCaloParticleAssociator_h +// Original Author: Leonardo Cristella + +// system include files +#include + +// user include files + +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociatorBaseImpl.h" + +// forward declarations + +namespace hgcal { + + class MultiClusterToCaloParticleAssociator { + public: + MultiClusterToCaloParticleAssociator(std::unique_ptr); + MultiClusterToCaloParticleAssociator() = default; + MultiClusterToCaloParticleAssociator(MultiClusterToCaloParticleAssociator &&) = default; + MultiClusterToCaloParticleAssociator &operator=(MultiClusterToCaloParticleAssociator &&) = default; + ~MultiClusterToCaloParticleAssociator() = default; + + // ---------- const member functions --------------------- + /// Associate a MultiCluster to CaloParticles + hgcal::RecoToSimCollectionWithMultiClusters associateRecoToSim( + const edm::Handle &cCCH, + const edm::Handle &cPCH) const { + return m_impl->associateRecoToSim(cCCH, cPCH); + }; + + /// Associate a CaloParticle to MultiClusters + hgcal::SimToRecoCollectionWithMultiClusters associateSimToReco( + const edm::Handle &cCCH, + const edm::Handle &cPCH) const { + return m_impl->associateSimToReco(cCCH, cPCH); + } + + private: + MultiClusterToCaloParticleAssociator(const MultiClusterToCaloParticleAssociator &) = delete; // stop default + + const MultiClusterToCaloParticleAssociator &operator=(const MultiClusterToCaloParticleAssociator &) = + delete; // stop default + + // ---------- member data -------------------------------- + std::unique_ptr m_impl; + }; +} // namespace hgcal + +#endif diff --git a/SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociatorBaseImpl.h b/SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociatorBaseImpl.h new file mode 100644 index 0000000000000..6d21a51cea9f3 --- /dev/null +++ b/SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociatorBaseImpl.h @@ -0,0 +1,47 @@ +#ifndef SimDataFormats_Associations_MultiClusterToCaloParticleAssociatorBaseImpl_h +#define SimDataFormats_Associations_MultiClusterToCaloParticleAssociatorBaseImpl_h + +/** \class MultiClusterToCaloParticleAssociatorBaseImpl + * + * Base class for MultiClusterToCaloParticleAssociators. Methods take as input + * the handle of MultiClusters and the CaloParticle collections and return an + * AssociationMap (oneToManyWithQuality) + * + * \author Leonardo Cristella + */ + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/AssociationMap.h" +#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" + +namespace hgcal { + + typedef edm::AssociationMap< + edm::OneToManyWithQualityGeneric>> + SimToRecoCollectionWithMultiClusters; + typedef edm::AssociationMap< + edm::OneToManyWithQualityGeneric> + RecoToSimCollectionWithMultiClusters; + + class MultiClusterToCaloParticleAssociatorBaseImpl { + public: + /// Constructor + MultiClusterToCaloParticleAssociatorBaseImpl(); + /// Destructor + virtual ~MultiClusterToCaloParticleAssociatorBaseImpl(); + + /// Associate a MultiCluster to CaloParticles + virtual hgcal::RecoToSimCollectionWithMultiClusters associateRecoToSim( + const edm::Handle &cCH, + const edm::Handle &cPCH) const; + + /// Associate a CaloParticle to MultiClusters + virtual hgcal::SimToRecoCollectionWithMultiClusters associateSimToReco( + const edm::Handle &cCH, + const edm::Handle &cPCH) const; + }; +} // namespace hgcal + +#endif diff --git a/SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h b/SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h new file mode 100644 index 0000000000000..0855fb24caa52 --- /dev/null +++ b/SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h @@ -0,0 +1,49 @@ +#ifndef SimDataFormats_Associations_TracksterToSimClusterAssociator_h +#define SimDataFormats_Associations_TracksterToSimClusterAssociator_h +// Original Author: Leonardo Cristella + +// system include files +#include + +// user include files + +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociatorBaseImpl.h" + +// forward declarations + +namespace hgcal { + + class TracksterToSimClusterAssociator { + public: + TracksterToSimClusterAssociator(std::unique_ptr); + TracksterToSimClusterAssociator() = default; + TracksterToSimClusterAssociator(TracksterToSimClusterAssociator &&) = default; + TracksterToSimClusterAssociator &operator=(TracksterToSimClusterAssociator &&) = default; + ~TracksterToSimClusterAssociator() = default; + + // ---------- const member functions --------------------- + /// Associate a Trackster to SimClusters + hgcal::RecoToSimCollectionTracksters associateRecoToSim(const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const { + return m_impl->associateRecoToSim(tCH, lCCH, sCCH); + }; + + /// Associate a SimCluster to Tracksters + hgcal::SimToRecoCollectionTracksters associateSimToReco(const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const { + return m_impl->associateSimToReco(tCH, lCCH, sCCH); + } + + private: + TracksterToSimClusterAssociator(const TracksterToSimClusterAssociator &) = delete; // stop default + + const TracksterToSimClusterAssociator &operator=(const TracksterToSimClusterAssociator &) = delete; // stop default + + // ---------- member data -------------------------------- + std::unique_ptr m_impl; + }; +} // namespace hgcal + +#endif diff --git a/SimDataFormats/Associations/interface/TracksterToSimClusterAssociatorBaseImpl.h b/SimDataFormats/Associations/interface/TracksterToSimClusterAssociatorBaseImpl.h new file mode 100644 index 0000000000000..236fd1dd3a81c --- /dev/null +++ b/SimDataFormats/Associations/interface/TracksterToSimClusterAssociatorBaseImpl.h @@ -0,0 +1,49 @@ +#ifndef SimDataFormats_Associations_TracksterToSimClusterAssociatorBaseImpl_h +#define SimDataFormats_Associations_TracksterToSimClusterAssociatorBaseImpl_h + +/** \class TracksterToSimClusterAssociatorBaseImpl + * + * Base class for TracksterToSimClusterAssociator. Methods take as input + * the handles of Tracksters, LayerClusters and SimClusters collections and return an + * AssociationMap (oneToManyWithQuality) + * + * \author Leonardo Cristella + */ + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/AssociationMap.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" +#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" + +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" + +namespace hgcal { + + typedef edm::AssociationMap< + edm::OneToManyWithQualityGeneric>> + SimToRecoCollectionTracksters; + typedef edm::AssociationMap> + RecoToSimCollectionTracksters; + + class TracksterToSimClusterAssociatorBaseImpl { + public: + /// Constructor + TracksterToSimClusterAssociatorBaseImpl(); + /// Destructor + virtual ~TracksterToSimClusterAssociatorBaseImpl(); + + /// Associate a Trackster to SimClusters + virtual hgcal::RecoToSimCollectionTracksters associateRecoToSim( + const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const; + + /// Associate a SimCluster to Tracksters + virtual hgcal::SimToRecoCollectionTracksters associateSimToReco( + const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const; + }; +} // namespace hgcal + +#endif diff --git a/SimDataFormats/Associations/plugins/BuildFile.xml b/SimDataFormats/Associations/plugins/BuildFile.xml index bd62ae6ee8f1b..bf4fdbfe7ae3a 100644 --- a/SimDataFormats/Associations/plugins/BuildFile.xml +++ b/SimDataFormats/Associations/plugins/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc b/SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc new file mode 100644 index 0000000000000..f6e01e8c6beeb --- /dev/null +++ b/SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc @@ -0,0 +1,95 @@ +// +// Original Author: Leonardo Cristella +// Created: Thu Dec 3 10:52:11 CET 2020 +// +// + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/global/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/Framework/interface/ESHandle.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" + +#include "FWCore/Utilities/interface/EDGetToken.h" + +// +// class decleration +// + +class TSToSCAssociatorEDProducer : public edm::global::EDProducer<> { +public: + explicit TSToSCAssociatorEDProducer(const edm::ParameterSet &); + ~TSToSCAssociatorEDProducer() override; + +private: + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; + + edm::EDGetTokenT SCCollectionToken_; + edm::EDGetTokenT TSCollectionToken_; + edm::EDGetTokenT LCCollectionToken_; + edm::EDGetTokenT associatorToken_; +}; + +TSToSCAssociatorEDProducer::TSToSCAssociatorEDProducer(const edm::ParameterSet &pset) { + produces(); + produces(); + + SCCollectionToken_ = consumes(pset.getParameter("label_scl")); + TSCollectionToken_ = consumes(pset.getParameter("label_tst")); + LCCollectionToken_ = consumes(pset.getParameter("label_lcl")); + associatorToken_ = consumes(pset.getParameter("associator")); +} + +TSToSCAssociatorEDProducer::~TSToSCAssociatorEDProducer() {} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +void TSToSCAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const { + using namespace edm; + + edm::Handle theAssociator; + iEvent.getByToken(associatorToken_, theAssociator); + + Handle SCCollection; + iEvent.getByToken(SCCollectionToken_, SCCollection); + + Handle TSCollection; + iEvent.getByToken(TSCollectionToken_, TSCollection); + + Handle LCCollection; + iEvent.getByToken(LCCollectionToken_, LCCollection); + + // associate LC and SC + LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n"; + hgcal::RecoToSimCollectionTracksters recSimColl = + theAssociator->associateRecoToSim(TSCollection, LCCollection, SCCollection); + + LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n"; + hgcal::SimToRecoCollectionTracksters simRecColl = + theAssociator->associateSimToReco(TSCollection, LCCollection, SCCollection); + + auto rts = std::make_unique(recSimColl); + auto str = std::make_unique(simRecColl); + + iEvent.put(std::move(rts)); + iEvent.put(std::move(str)); +} + +// define this as a plug-in +DEFINE_FWK_MODULE(TSToSCAssociatorEDProducer); diff --git a/SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociator.cc b/SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociator.cc new file mode 100644 index 0000000000000..5b13f8ef8a4ae --- /dev/null +++ b/SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociator.cc @@ -0,0 +1,7 @@ +// Original Author: Leonardo Cristella + +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h" + +hgcal::MultiClusterToCaloParticleAssociator::MultiClusterToCaloParticleAssociator( + std::unique_ptr ptr) + : m_impl(std::move(ptr)) {} diff --git a/SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociatorBaseImpl.cc b/SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociatorBaseImpl.cc new file mode 100644 index 0000000000000..3b9768beae315 --- /dev/null +++ b/SimDataFormats/Associations/src/MultiClusterToCaloParticleAssociatorBaseImpl.cc @@ -0,0 +1,21 @@ +// Original Author: Leonardo Cristella + +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociatorBaseImpl.h" + +namespace hgcal { + MultiClusterToCaloParticleAssociatorBaseImpl::MultiClusterToCaloParticleAssociatorBaseImpl(){}; + MultiClusterToCaloParticleAssociatorBaseImpl::~MultiClusterToCaloParticleAssociatorBaseImpl(){}; + + hgcal::RecoToSimCollectionWithMultiClusters MultiClusterToCaloParticleAssociatorBaseImpl::associateRecoToSim( + const edm::Handle &cCCH, + const edm::Handle &cPCH) const { + return hgcal::RecoToSimCollectionWithMultiClusters(); + } + + hgcal::SimToRecoCollectionWithMultiClusters MultiClusterToCaloParticleAssociatorBaseImpl::associateSimToReco( + const edm::Handle &cCCH, + const edm::Handle &cPCH) const { + return hgcal::SimToRecoCollectionWithMultiClusters(); + } + +} // namespace hgcal diff --git a/SimDataFormats/Associations/src/TracksterToSimClusterAssociator.cc b/SimDataFormats/Associations/src/TracksterToSimClusterAssociator.cc new file mode 100644 index 0000000000000..791ab3acfecf1 --- /dev/null +++ b/SimDataFormats/Associations/src/TracksterToSimClusterAssociator.cc @@ -0,0 +1,7 @@ +// Original Author: Leonardo Cristella + +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" + +hgcal::TracksterToSimClusterAssociator::TracksterToSimClusterAssociator( + std::unique_ptr ptr) + : m_impl(std::move(ptr)) {} diff --git a/SimDataFormats/Associations/src/TracksterToSimClusterAssociatorBaseImpl.cc b/SimDataFormats/Associations/src/TracksterToSimClusterAssociatorBaseImpl.cc new file mode 100644 index 0000000000000..a049ff94788e5 --- /dev/null +++ b/SimDataFormats/Associations/src/TracksterToSimClusterAssociatorBaseImpl.cc @@ -0,0 +1,23 @@ +// Original Author: Leonardo Cristella + +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociatorBaseImpl.h" + +namespace hgcal { + TracksterToSimClusterAssociatorBaseImpl::TracksterToSimClusterAssociatorBaseImpl(){}; + TracksterToSimClusterAssociatorBaseImpl::~TracksterToSimClusterAssociatorBaseImpl(){}; + + hgcal::RecoToSimCollectionTracksters TracksterToSimClusterAssociatorBaseImpl::associateRecoToSim( + const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const { + return hgcal::RecoToSimCollectionTracksters(); + } + + hgcal::SimToRecoCollectionTracksters TracksterToSimClusterAssociatorBaseImpl::associateSimToReco( + const edm::Handle &tCH, + const edm::Handle &lCCH, + const edm::Handle &sCCH) const { + return hgcal::SimToRecoCollectionTracksters(); + } + +} // namespace hgcal diff --git a/SimDataFormats/Associations/src/classes.h b/SimDataFormats/Associations/src/classes.h index 7f09758b1d166..d327d03291380 100644 --- a/SimDataFormats/Associations/src/classes.h +++ b/SimDataFormats/Associations/src/classes.h @@ -8,6 +8,8 @@ #include "SimDataFormats/Associations/interface/VertexToTrackingVertexAssociator.h" #include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h" #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h" +#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" +#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h" #include "SimDataFormats/Associations/interface/TTTrackTruthPair.h" namespace SimDataFormats_Associations { @@ -23,6 +25,10 @@ namespace SimDataFormats_Associations { edm::Wrapper dummy6; + edm::Wrapper dummy7; + + edm::Wrapper dummy8; + reco::VertexSimToRecoCollection vstrc; reco::VertexSimToRecoCollection::const_iterator vstrci; edm::Wrapper wvstrc; diff --git a/SimDataFormats/Associations/src/classes_def.xml b/SimDataFormats/Associations/src/classes_def.xml index 116402321d6c1..0e1edcd95fc26 100644 --- a/SimDataFormats/Associations/src/classes_def.xml +++ b/SimDataFormats/Associations/src/classes_def.xml @@ -15,6 +15,12 @@ + + + + + + @@ -24,6 +30,7 @@ + @@ -38,6 +45,7 @@ + @@ -47,11 +55,37 @@ + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + diff --git a/SimFastTiming/FastTimingCommon/interface/BTLDeviceSim.h b/SimFastTiming/FastTimingCommon/interface/BTLDeviceSim.h index b61faac8d9502..c729e567545fc 100644 --- a/SimFastTiming/FastTimingCommon/interface/BTLDeviceSim.h +++ b/SimFastTiming/FastTimingCommon/interface/BTLDeviceSim.h @@ -22,7 +22,7 @@ namespace CLHEP { class BTLDeviceSim { public: - BTLDeviceSim(const edm::ParameterSet& pset); + BTLDeviceSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC); void getEvent(const edm::Event& evt) {} @@ -34,6 +34,8 @@ class BTLDeviceSim { CLHEP::HepRandomEngine* hre); private: + const edm::ESGetToken geomToken_; + const edm::ESGetToken topoToken_; const MTDGeometry* geom_; const MTDTopology* topo_; diff --git a/SimFastTiming/FastTimingCommon/interface/BTLElectronicsSim.h b/SimFastTiming/FastTimingCommon/interface/BTLElectronicsSim.h index fd648bf4cdc88..27e90d3e5a162 100644 --- a/SimFastTiming/FastTimingCommon/interface/BTLElectronicsSim.h +++ b/SimFastTiming/FastTimingCommon/interface/BTLElectronicsSim.h @@ -20,7 +20,7 @@ namespace CLHEP { class BTLElectronicsSim { public: - BTLElectronicsSim(const edm::ParameterSet& pset); + BTLElectronicsSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC); void getEvent(const edm::Event& evt) {} diff --git a/SimFastTiming/FastTimingCommon/interface/ETLDeviceSim.h b/SimFastTiming/FastTimingCommon/interface/ETLDeviceSim.h index 05df1d9fdb4c3..32cdab56ec70b 100644 --- a/SimFastTiming/FastTimingCommon/interface/ETLDeviceSim.h +++ b/SimFastTiming/FastTimingCommon/interface/ETLDeviceSim.h @@ -20,7 +20,7 @@ namespace CLHEP { class ETLDeviceSim { public: - ETLDeviceSim(const edm::ParameterSet& pset); + ETLDeviceSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC); void getEvent(const edm::Event& evt) {} @@ -32,6 +32,7 @@ class ETLDeviceSim { CLHEP::HepRandomEngine* hre); private: + const edm::ESGetToken geomToken_; const MTDGeometry* geom_; float MIPPerMeV_; diff --git a/SimFastTiming/FastTimingCommon/interface/ETLElectronicsSim.h b/SimFastTiming/FastTimingCommon/interface/ETLElectronicsSim.h index e11ff6afab787..79945a097e021 100644 --- a/SimFastTiming/FastTimingCommon/interface/ETLElectronicsSim.h +++ b/SimFastTiming/FastTimingCommon/interface/ETLElectronicsSim.h @@ -24,7 +24,7 @@ namespace CLHEP { class ETLElectronicsSim { public: - ETLElectronicsSim(const edm::ParameterSet& pset); + ETLElectronicsSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC); void getEvent(const edm::Event& evt) {} @@ -43,6 +43,7 @@ class ETLElectronicsSim { static constexpr int dfSIZE = 5; private: + const edm::ESGetToken geomToken_; const MTDGeometry* geom_; const bool debug_; diff --git a/SimFastTiming/FastTimingCommon/interface/MTDDigitizer.h b/SimFastTiming/FastTimingCommon/interface/MTDDigitizer.h index e546279165f59..69c507c67b60b 100644 --- a/SimFastTiming/FastTimingCommon/interface/MTDDigitizer.h +++ b/SimFastTiming/FastTimingCommon/interface/MTDDigitizer.h @@ -9,14 +9,13 @@ #include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ProducesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/Records/interface/MTDDigiGeometryRecord.h" #include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CommonDetUnit/interface/GeomDetType.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h" @@ -136,9 +135,10 @@ namespace mtd_digitizer { MTDDigitizer(const edm::ParameterSet& config, edm::ProducesCollector producesCollector, edm::ConsumesCollector& iC) : MTDDigitizerBase(config, producesCollector, iC), + geomToken_(iC.esConsumes()), geom_(nullptr), - deviceSim_(config.getParameterSet("DeviceSimulation")), - electronicsSim_(config.getParameterSet("ElectronicsSimulation")), + deviceSim_(config.getParameterSet("DeviceSimulation"), iC), + electronicsSim_(config.getParameterSet("ElectronicsSimulation"), iC), maxSimHitsAccTime_(config.getParameter("maxSimHitsAccTime")) {} ~MTDDigitizer() override {} @@ -160,15 +160,10 @@ namespace mtd_digitizer { void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override; void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre) override; - /** - @short actions at the start/end of run - */ - void beginRun(const edm::EventSetup& es) override; - void endRun() override {} - private: void resetSimHitDataAccumulator() { MTDSimHitDataAccumulator().swap(simHitAccumulator_); } + const edm::ESGetToken geomToken_; const MTDGeometry* geom_; // implementations @@ -234,9 +229,13 @@ namespace mtd_digitizer { template void MTDDigitizer::initializeEvent(edm::Event const& e, edm::EventSetup const& c) { + geom_ = &c.getData(geomToken_); + deviceSim_.getEvent(e); + deviceSim_.getEventSetup(c); if (not premixStage1_) { electronicsSim_.getEvent(e); + electronicsSim_.getEventSetup(c); } } @@ -255,18 +254,6 @@ namespace mtd_digitizer { //release memory for next event resetSimHitDataAccumulator(); } - - template - void MTDDigitizer::beginRun(const edm::EventSetup& es) { - edm::ESHandle geom; - es.get().get(geom); - geom_ = geom.product(); - - deviceSim_.getEventSetup(es); - if (not premixStage1_) { - electronicsSim_.getEventSetup(es); - } - } } // namespace mtd_digitizer #endif diff --git a/SimFastTiming/FastTimingCommon/interface/MTDDigitizerBase.h b/SimFastTiming/FastTimingCommon/interface/MTDDigitizerBase.h index 9658d1f3fa99e..c358d6d90d42f 100644 --- a/SimFastTiming/FastTimingCommon/interface/MTDDigitizerBase.h +++ b/SimFastTiming/FastTimingCommon/interface/MTDDigitizerBase.h @@ -78,12 +78,6 @@ class MTDDigitizerBase { virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c) = 0; virtual void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre) = 0; - /** - @short actions at the start/end of run - */ - virtual void beginRun(const edm::EventSetup& es) = 0; - virtual void endRun() = 0; - const std::string& name() const { return name_; } protected: diff --git a/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.cc b/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.cc index 4538e4b8fc82c..ee468120b070c 100644 --- a/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.cc +++ b/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.cc @@ -56,17 +56,3 @@ void MTDDigiProducer::accumulate(PileUpEventPrincipal const& event, digitizer->accumulate(event, es, randomEngine_); } } - -// -void MTDDigiProducer::beginRun(edm::Run const&, edm::EventSetup const& es) { - for (auto& digitizer : theDigitizers_) { - digitizer->beginRun(es); - } -} - -// -void MTDDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) { - for (auto& digitizer : theDigitizers_) { - digitizer->endRun(); - } -} diff --git a/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.h b/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.h index dc83a658c50ef..854d0aaa33d37 100644 --- a/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.h +++ b/SimFastTiming/FastTimingCommon/plugins/MTDDigiProducer.h @@ -1,6 +1,7 @@ #ifndef SimFastTiming_FastTimingCommon_MTDDigiProducer_h #define SimFastTiming_FastTimingCommon_MTDDigiProducer_h +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/Framework/interface/ProducesCollector.h" #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" #include "SimFastTiming/FastTimingCommon/interface/MTDDigitizerBase.h" @@ -8,12 +9,6 @@ #include #include -namespace edm { - class ConsumesCollector; - class ParameterSet; - class StreamID; -} // namespace edm - namespace CLHEP { class HepRandomEngine; } @@ -30,8 +25,6 @@ class MTDDigiProducer : public DigiAccumulatorMixMod { void finalizeEvent(edm::Event&, edm::EventSetup const&) override; void accumulate(edm::Event const&, edm::EventSetup const&) override; void accumulate(PileUpEventPrincipal const&, edm::EventSetup const&, edm::StreamID const&) override; - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endRun(edm::Run const&, edm::EventSetup const&) override; ~MTDDigiProducer() override; private: diff --git a/SimFastTiming/FastTimingCommon/plugins/PreMixingMTDWorker.cc b/SimFastTiming/FastTimingCommon/plugins/PreMixingMTDWorker.cc index a2f1fac1b9c15..f9a985d97f844 100644 --- a/SimFastTiming/FastTimingCommon/plugins/PreMixingMTDWorker.cc +++ b/SimFastTiming/FastTimingCommon/plugins/PreMixingMTDWorker.cc @@ -24,9 +24,7 @@ class PreMixingMTDWorker : public PreMixingWorker { PreMixingMTDWorker(const PreMixingMTDWorker&) = delete; PreMixingMTDWorker& operator=(const PreMixingMTDWorker&) = delete; - void beginRun(const edm::Run& run, const edm::EventSetup& ES) override; - void endRun() override; - void initializeEvent(const edm::Event& e, const edm::EventSetup& ES) override {} + void initializeEvent(const edm::Event& e, const edm::EventSetup& ES) override; void addSignals(const edm::Event& e, const edm::EventSetup& ES) override; void addPileups(const PileUpEventPrincipal&, const edm::EventSetup& ES) override; void put(edm::Event& e, const edm::EventSetup& ES, std::vector const& ps, int bs) override; @@ -47,9 +45,9 @@ PreMixingMTDWorker::PreMixingMTDWorker(const edm::ParameterSet& ps, digitizer_(MTDDigitizerFactory::get()->create( ps.getParameter("digitizerName"), ps, producesCollector, iC)) {} -void PreMixingMTDWorker::beginRun(const edm::Run& run, const edm::EventSetup& ES) { digitizer_->beginRun(ES); } - -void PreMixingMTDWorker::endRun() { digitizer_->endRun(); } +void PreMixingMTDWorker::initializeEvent(const edm::Event& e, const edm::EventSetup& ES) { + digitizer_->initializeEvent(e, ES); +} void PreMixingMTDWorker::addSignals(const edm::Event& e, const edm::EventSetup& ES) { edm::Handle handle; diff --git a/SimFastTiming/FastTimingCommon/src/BTLDeviceSim.cc b/SimFastTiming/FastTimingCommon/src/BTLDeviceSim.cc index 812bd6f4321b3..062fec9ffe21a 100644 --- a/SimFastTiming/FastTimingCommon/src/BTLDeviceSim.cc +++ b/SimFastTiming/FastTimingCommon/src/BTLDeviceSim.cc @@ -3,8 +3,8 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/MTDDetId.h" #include "DataFormats/ForwardDetId/interface/BTLDetId.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CommonDetUnit/interface/GeomDetType.h" #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h" #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" @@ -12,8 +12,10 @@ #include "CLHEP/Random/RandGaussQ.h" -BTLDeviceSim::BTLDeviceSim(const edm::ParameterSet& pset) - : geom_(nullptr), +BTLDeviceSim::BTLDeviceSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC) + : geomToken_(iC.esConsumes()), + topoToken_(iC.esConsumes()), + geom_(nullptr), topo_(nullptr), bxTime_(pset.getParameter("bxTime")), LightYield_(pset.getParameter("LightYield")), @@ -23,13 +25,8 @@ BTLDeviceSim::BTLDeviceSim(const edm::ParameterSet& pset) PDE_(pset.getParameter("PhotonDetectionEff")) {} void BTLDeviceSim::getEventSetup(const edm::EventSetup& evs) { - edm::ESHandle geom; - evs.get().get(geom); - geom_ = geom.product(); - - edm::ESHandle mtdTopo; - evs.get().get(mtdTopo); - topo_ = mtdTopo.product(); + geom_ = &evs.getData(geomToken_); + topo_ = &evs.getData(topoToken_); } void BTLDeviceSim::getHitsResponse(const std::vector >& hitRefs, @@ -53,8 +50,7 @@ void BTLDeviceSim::getHitsResponse(const std::vectorgetMTDTopologyMode())); - DetId geoId = BTLDetId(btlid.mtdSide(), btlid.mtdRR(), btlid.module() + boundRef * (btlid.modType() - 1), 0, 1); + DetId geoId = btlid.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(topo_->getMTDTopologyMode())); const MTDGeomDet* thedet = geom_->idToDet(geoId); if (thedet == nullptr) { diff --git a/SimFastTiming/FastTimingCommon/src/BTLElectronicsSim.cc b/SimFastTiming/FastTimingCommon/src/BTLElectronicsSim.cc index eda2fc34d0ee0..33663dd7dbf17 100644 --- a/SimFastTiming/FastTimingCommon/src/BTLElectronicsSim.cc +++ b/SimFastTiming/FastTimingCommon/src/BTLElectronicsSim.cc @@ -1,5 +1,6 @@ #include "SimFastTiming/FastTimingCommon/interface/BTLElectronicsSim.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CLHEP/Random/RandPoissonQ.h" @@ -7,7 +8,7 @@ using namespace mtd; -BTLElectronicsSim::BTLElectronicsSim(const edm::ParameterSet& pset) +BTLElectronicsSim::BTLElectronicsSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC) : debug_(pset.getUntrackedParameter("debug", false)), bxTime_(pset.getParameter("bxTime")), testBeamMIPTimeRes_(pset.getParameter("TestBeamMIPTimeRes")), diff --git a/SimFastTiming/FastTimingCommon/src/ETLDeviceSim.cc b/SimFastTiming/FastTimingCommon/src/ETLDeviceSim.cc index 5e5df0868e313..4ef834e20ee3d 100644 --- a/SimFastTiming/FastTimingCommon/src/ETLDeviceSim.cc +++ b/SimFastTiming/FastTimingCommon/src/ETLDeviceSim.cc @@ -1,24 +1,25 @@ #include "CLHEP/Units/GlobalPhysicalConstants.h" #include "SimFastTiming/FastTimingCommon/interface/ETLDeviceSim.h" #include "DataFormats/Math/interface/GeantUnits.h" + #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/MTDDetId.h" #include "DataFormats/ForwardDetId/interface/ETLDetId.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "Geometry/CommonDetUnit/interface/GeomDetType.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h" +#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" -ETLDeviceSim::ETLDeviceSim(const edm::ParameterSet& pset) - : geom_(nullptr), +ETLDeviceSim::ETLDeviceSim(const edm::ParameterSet& pset, edm::ConsumesCollector iC) + : geomToken_(iC.esConsumes()), + geom_(nullptr), MIPPerMeV_(1.0 / pset.getParameter("meVPerMIP")), bxTime_(pset.getParameter("bxTime")), tofDelay_(pset.getParameter("tofDelay")) {} -void ETLDeviceSim::getEventSetup(const edm::EventSetup& evs) { - edm::ESHandle geom; - evs.get().get(geom); - geom_ = geom.product(); -} +void ETLDeviceSim::getEventSetup(const edm::EventSetup& evs) { geom_ = &evs.getData(geomToken_); } void ETLDeviceSim::getHitsResponse(const std::vector >& hitRefs, const edm::Handle& hits, @@ -49,7 +50,8 @@ void ETLDeviceSim::getHitsResponse(const std::vector(thedet->topology()); + const ProxyMTDTopology& topoproxy = static_cast(thedet->topology()); + const RectangularMTDTopology& topo = static_cast(topoproxy.specificTopology()); const float toa = std::get<2>(hitRefs[i]) + tofDelay_; const PSimHit& hit = hits->at(hitidx); @@ -59,6 +61,11 @@ void ETLDeviceSim::getHitsResponse(const std::vector("debug", false)), bxTime_(pset.getParameter("bxTime")), integratedLum_(pset.getParameter("IntegratedLuminosity")), @@ -22,11 +24,7 @@ ETLElectronicsSim::ETLElectronicsSim(const edm::ParameterSet& pset) toaLSB_ns_(pset.getParameter("toaLSB_ns")), tdcBitSaturation_(std::pow(2, tdcNbits_) - 1) {} -void ETLElectronicsSim::getEventSetup(const edm::EventSetup& evs) { - edm::ESHandle geom; - evs.get().get(geom); - geom_ = geom.product(); -} +void ETLElectronicsSim::getEventSetup(const edm::EventSetup& evs) { geom_ = &evs.getData(geomToken_); } void ETLElectronicsSim::run(const mtd::MTDSimHitDataAccumulator& input, ETLDigiCollection& output, diff --git a/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc b/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc index e3f30247129ab..646cc67dfac7d 100644 --- a/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc +++ b/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc @@ -13,14 +13,14 @@ class MTDDigiDump : public edm::one::EDAnalyzer { public: explicit MTDDigiDump(const edm::ParameterSet&); - ~MTDDigiDump(); + ~MTDDigiDump() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void beginJob() override; - virtual void analyze(const edm::Event&, const edm::EventSetup&) override; - virtual void endJob() override; + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; // ----------member data --------------------------- @@ -53,7 +53,7 @@ void MTDDigiDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu // --- BTL DIGIs: - if (h_BTL_digi->size() > 0) { + if (!h_BTL_digi->empty()) { std::cout << " ----------------------------------------" << std::endl; std::cout << " BTL DIGI collection:" << std::endl; @@ -84,7 +84,7 @@ void MTDDigiDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu // --- ETL DIGIs: - if (h_ETL_digi->size() > 0) { + if (!h_ETL_digi->empty()) { std::cout << " ----------------------------------------" << std::endl; std::cout << " ETL DIGI collection:" << std::endl; diff --git a/SimG4Core/Application/interface/LowEnergyFastSimModel.h b/SimG4Core/Application/interface/LowEnergyFastSimModel.h index 300ab6106cc31..a806a9577c4d2 100644 --- a/SimG4Core/Application/interface/LowEnergyFastSimModel.h +++ b/SimG4Core/Application/interface/LowEnergyFastSimModel.h @@ -10,6 +10,8 @@ #include "G4Region.hh" #include "G4Types.hh" +class TrackingAction; + class LowEnergyFastSimModel : public G4VFastSimulationModel { public: LowEnergyFastSimModel(const G4String& name, G4Region* region, const edm::ParameterSet& parSet); @@ -19,8 +21,9 @@ class LowEnergyFastSimModel : public G4VFastSimulationModel { void DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep) override; private: - const G4double fEmax; - const G4Envelope* const fRegion; + G4double fEmax; + const G4Envelope* fRegion; + const TrackingAction* fTrackingAction; GFlashHitMaker fHitMaker; LowEnergyFastSimParam param; }; diff --git a/SimG4Core/Application/interface/RunManagerMT.h b/SimG4Core/Application/interface/RunManagerMT.h index 66b71bbdd2c17..093f0c48911b1 100644 --- a/SimG4Core/Application/interface/RunManagerMT.h +++ b/SimG4Core/Application/interface/RunManagerMT.h @@ -102,7 +102,6 @@ class RunManagerMT { const std::string m_PhysicsTablesDir; bool m_StorePhysicsTables; bool m_RestorePhysicsTables; - bool m_UseParametrisedEMPhysics; bool m_check; edm::ParameterSet m_pPhysics; edm::ParameterSet m_pRunAction; diff --git a/SimG4Core/Application/python/g4SimHits_cfi.py b/SimG4Core/Application/python/g4SimHits_cfi.py index c820f25a472fb..b9572949f64ae 100644 --- a/SimG4Core/Application/python/g4SimHits_cfi.py +++ b/SimG4Core/Application/python/g4SimHits_cfi.py @@ -162,6 +162,14 @@ CutsOnProton = cms.bool(True), DefaultCutValue = cms.double(1.0), ## cuts in cm G4BremsstrahlungThreshold = cms.double(0.5), ## cut in GeV + G4MuonBremsstrahlungThreshold = cms.double(10000.), ## cut in GeV + G4MscRangeFactor = cms.double(0.04), + G4MscGeomFactor = cms.double(2.5), + G4MscSafetyFactor = cms.double(0.6), + G4MscLambdaLimit = cms.double(1.0), # mm + G4MscStepLimit = cms.string("UseSafety"), + G4GeneralProcess = cms.bool(False), + ReadMuonData = cms.bool(False), Verbosity = cms.untracked.int32(0), # 1 will print cuts as they get set from DD # 2 will do as 1 + will dump Geant4 table of cuts @@ -188,7 +196,7 @@ EmaxFTFP = cms.double(25.), # in GeV EmaxBERTpi = cms.double(12.), # in GeV LowEnergyGflashEcal = cms.bool(False), - LowEnergyGflashEcalEmax = cms.double(100), + LowEnergyGflashEcalEmax = cms.double(0.02), # in GeV GflashEcal = cms.bool(False), GflashHcal = cms.bool(False), GflashEcalHad = cms.bool(False), @@ -216,8 +224,8 @@ EnergyRMSE = cms.vdouble(0.0,0.0), MinStepLimit = cms.double(1.0), ModifyTransportation = cms.bool(False), - ThresholdWarningEnergy = cms.untracked.double(100.0), - ThresholdImportantEnergy = cms.untracked.double(250.0), + ThresholdWarningEnergy = cms.untracked.double(100.0), #in MeV + ThresholdImportantEnergy = cms.untracked.double(250.0), #in MeV ThresholdTrials = cms.untracked.int32(10) ), Generator = cms.PSet( diff --git a/SimG4Core/Application/src/LowEnergyFastSimModel.cc b/SimG4Core/Application/src/LowEnergyFastSimModel.cc index ef15c4a228cd2..9722e4a1bc2e5 100644 --- a/SimG4Core/Application/src/LowEnergyFastSimModel.cc +++ b/SimG4Core/Application/src/LowEnergyFastSimModel.cc @@ -2,8 +2,10 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimG4Core/Application/interface/LowEnergyFastSimModel.h" +#include "SimG4Core/Application/interface/TrackingAction.h" #include "G4VFastSimulationModel.hh" +#include "G4EventManager.hh" #include "G4Electron.hh" #include "GFlashHitMaker.hh" #include "G4Region.hh" @@ -12,16 +14,23 @@ constexpr double twomass = 2 * CLHEP::electron_mass_c2; LowEnergyFastSimModel::LowEnergyFastSimModel(const G4String& name, G4Region* region, const edm::ParameterSet& parSet) - : G4VFastSimulationModel(name, region), - fEmax(parSet.getParameter("LowEnergyGflashEcalEmax")), - fRegion(region) {} + : G4VFastSimulationModel(name, region), fRegion(region), fTrackingAction(nullptr) { + fEmax = parSet.getParameter("LowEnergyGflashEcalEmax") * CLHEP::GeV; +} G4bool LowEnergyFastSimModel::IsApplicable(const G4ParticleDefinition& particle) { return (11 == std::abs(particle.GetPDGEncoding())); } G4bool LowEnergyFastSimModel::ModelTrigger(const G4FastTrack& fastTrack) { - G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy(); + const G4Track* track = fastTrack.GetPrimaryTrack(); + if (nullptr == fTrackingAction) { + fTrackingAction = static_cast(G4EventManager::GetEventManager()->GetUserTrackingAction()); + } + int pdgMother = std::abs(fTrackingAction->geant4Track()->GetDefinition()->GetPDGEncoding()); + if (pdgMother == 11 || pdgMother == 22) + return false; + G4double energy = track->GetKineticEnergy(); return energy < fEmax && fRegion == fastTrack.GetEnvelope(); } diff --git a/SimG4Core/Application/src/ParametrisedEMPhysics.cc b/SimG4Core/Application/src/ParametrisedEMPhysics.cc index 9c25252e3a08c..a7c43d2486200 100644 --- a/SimG4Core/Application/src/ParametrisedEMPhysics.cc +++ b/SimG4Core/Application/src/ParametrisedEMPhysics.cc @@ -14,12 +14,8 @@ #include "G4FastSimulationManagerProcess.hh" #include "G4ProcessManager.hh" +#include "G4EmBuilder.hh" -#include "G4LeptonConstructor.hh" -#include "G4MesonConstructor.hh" -#include "G4BaryonConstructor.hh" -#include "G4ShortLivedConstructor.hh" -#include "G4IonConstructor.hh" #include "G4RegionStore.hh" #include "G4Electron.hh" #include "G4Positron.hh" @@ -66,13 +62,20 @@ G4ThreadLocal ParametrisedEMPhysics::TLSmod* ParametrisedEMPhysics::m_tpmod = nu ParametrisedEMPhysics::ParametrisedEMPhysics(const std::string& name, const edm::ParameterSet& p) : G4VPhysicsConstructor(name), theParSet(p) { - // bremsstrahlung threshold and EM verbosity G4EmParameters* param = G4EmParameters::Instance(); G4int verb = theParSet.getUntrackedParameter("Verbosity", 0); param->SetVerbose(verb); - G4double bremth = theParSet.getParameter("G4BremsstrahlungThreshold") * GeV; + G4double bremth = theParSet.getParameter("G4BremsstrahlungThreshold") * CLHEP::GeV; param->SetBremsstrahlungTh(bremth); + G4double mubrth = theParSet.getParameter("G4MuonBremsstrahlungThreshold") * CLHEP::GeV; + param->SetMuHadBremsstrahlungTh(mubrth); + + bool genp = theParSet.getParameter("G4GeneralProcess"); + param->SetGeneralProcessActive(genp); + + bool mudat = theParSet.getParameter("ReadMuonData"); + param->SetRetrieveMuDataFromFile(mudat); bool fluo = theParSet.getParameter("FlagFluo"); param->SetFluo(fluo); @@ -112,18 +115,13 @@ ParametrisedEMPhysics::ParametrisedEMPhysics(const std::string& name, const edm: } ParametrisedEMPhysics::~ParametrisedEMPhysics() { - if (m_tpmod) { - delete m_tpmod; - m_tpmod = nullptr; - } + delete m_tpmod; + m_tpmod = nullptr; } void ParametrisedEMPhysics::ConstructParticle() { - G4LeptonConstructor pLeptonConstructor; - pLeptonConstructor.ConstructParticle(); - - G4BaryonConstructor pBaryonConstructor; - pBaryonConstructor.ConstructParticle(); + // minimal set of particles for EM physics + G4EmBuilder::ConstructMinimalEmSet(); } void ParametrisedEMPhysics::ConstructProcess() { diff --git a/SimG4Core/Application/src/RunManagerMT.cc b/SimG4Core/Application/src/RunManagerMT.cc index 177bf0fd2d306..bc79172131078 100644 --- a/SimG4Core/Application/src/RunManagerMT.cc +++ b/SimG4Core/Application/src/RunManagerMT.cc @@ -70,7 +70,6 @@ RunManagerMT::RunManagerMT(edm::ParameterSet const& p) m_PhysicsTablesDir(p.getUntrackedParameter("PhysicsTablesDirectory", "")), m_StorePhysicsTables(p.getUntrackedParameter("StorePhysicsTables", false)), m_RestorePhysicsTables(p.getUntrackedParameter("RestorePhysicsTables", false)), - m_UseParametrisedEMPhysics(p.getUntrackedParameter("UseParametrisedEMPhysics")), m_pPhysics(p.getParameter("Physics")), m_pRunAction(p.getParameter("RunAction")), m_g4overlap(p.getUntrackedParameter("G4CheckOverlap")), @@ -171,8 +170,7 @@ void RunManagerMT::initG4(const DDCompactView* pDD, // adding GFlash, Russian Roulette for eletrons and gamma, // step limiters on top of any Physics Lists - if (m_UseParametrisedEMPhysics) - phys->RegisterPhysics(new ParametrisedEMPhysics("EMoptions", m_pPhysics)); + phys->RegisterPhysics(new ParametrisedEMPhysics("EMoptions", m_pPhysics)); if (m_RestorePhysicsTables) { m_physicsList->SetPhysicsTableRetrieved(m_PhysicsTablesDir); diff --git a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D49_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py similarity index 97% rename from SimG4Core/Configuration/test/dd4hep_ttbar_2026D49_Step1_cfg.py rename to SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py index 0df81bd5a8d43..a8910e03b01a0 100644 --- a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D49_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ttbar_2026D77_Step1_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C9_dd4hep_cff import Phase2C9_dd4hep +from Configuration.Eras.Era_Phase2C11_dd4hep_cff import Phase2C11_dd4hep -process = cms.Process('SIM',Phase2C9_dd4hep) +process = cms.Process('SIM',Phase2C11_dd4hep) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -10,7 +10,7 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D49_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2026D77_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') @@ -22,6 +22,7 @@ if hasattr(process,'MessageLogger'): process.MessageLogger.cerr.Geometry=dict() process.MessageLogger.cerr.SimG4CoreApplication=dict() + process.MessageLogger.cerr.HGCalGeom=dict() process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10), @@ -85,7 +86,7 @@ # Other statements process.genstepfilter.triggerConditions=cms.vstring("generation_step") from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') process.generator = cms.EDFilter("Pythia8GeneratorFilter", PythiaParameters = cms.PSet( diff --git a/SimG4Core/CustomPhysics/data/particle_darkphoton.txt b/SimG4Core/CustomPhysics/data/particle_darkphoton.txt index 3cb6ba44eecbe..c61d7a2d3cc5c 100644 --- a/SimG4Core/CustomPhysics/data/particle_darkphoton.txt +++ b/SimG4Core/CustomPhysics/data/particle_darkphoton.txt @@ -1,4 +1,5 @@ Block MASS # # PDG code mass particle - 1072000 0.0 # darkphoton + 1072000 0.0 # darkphoton + 1023 0.0005 # darkphoton1 Block diff --git a/SimG4Core/CustomPhysics/interface/CMSDarkPairProductionProcess.h b/SimG4Core/CustomPhysics/interface/CMSDarkPairProductionProcess.h index 11a60ee743406..4d3c87e00c7db 100644 --- a/SimG4Core/CustomPhysics/interface/CMSDarkPairProductionProcess.h +++ b/SimG4Core/CustomPhysics/interface/CMSDarkPairProductionProcess.h @@ -32,9 +32,6 @@ class CMSDarkPairProductionProcess : public G4VEmProcess G4double MinPrimaryEnergy(const G4ParticleDefinition*, const G4Material*) override; - // Print few lines of informations about the process: validity range, - void PrintInfo() override; - protected: void InitialiseProcess(const G4ParticleDefinition*) override; diff --git a/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticProcess.h b/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticProcess.h index 12c78d5dbcf46..1bad6124d675f 100644 --- a/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticProcess.h +++ b/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticProcess.h @@ -16,11 +16,10 @@ class CMSSIMPInelasticProcess : public G4HadronicProcess { // generic PostStepDoIt recommended for all derived classes G4VParticleChange* PostStepDoIt(const G4Track& aTrack, const G4Step& aStep) override; -private: - // hide assignment operator as private CMSSIMPInelasticProcess& operator=(const CMSSIMPInelasticProcess& right) = delete; CMSSIMPInelasticProcess(const CMSSIMPInelasticProcess&) = delete; +private: G4ParticleDefinition* theParticle; }; diff --git a/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticXS.h b/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticXS.h index 9dfa38287b386..53cbb2e636140 100644 --- a/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticXS.h +++ b/SimG4Core/CustomPhysics/interface/CMSSIMPInelasticXS.h @@ -27,12 +27,12 @@ class CMSSIMPInelasticXS : public G4VCrossSectionDataSet { void BuildPhysicsTable(const G4ParticleDefinition&) override; -private: - void Initialise(G4int Z, G4DynamicParticle* dp = nullptr, const char* = nullptr); - CMSSIMPInelasticXS& operator=(const CMSSIMPInelasticXS& right) = delete; CMSSIMPInelasticXS(const CMSSIMPInelasticXS&) = delete; +private: + void Initialise(G4int Z, G4DynamicParticle* dp = nullptr, const char* = nullptr); + G4NeutronInelasticXS* nXsection; const G4ParticleDefinition* neutron; G4bool isInitialized; diff --git a/SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h b/SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h index ce949c08578dd..fca284fa1028f 100644 --- a/SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h +++ b/SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h @@ -3,16 +3,7 @@ #include "globals.hh" #include "G4HadronicProcess.hh" -#include "G4CrossSectionDataStore.hh" -#include "G4HadronElasticDataSet.hh" -#include "G4Element.hh" -#include "G4ElementVector.hh" -#include "G4VDiscreteProcess.hh" -#include "G4LightMedia.hh" -#include "G4Step.hh" -#include "G4TrackStatus.hh" - -#include +#include "G4ParticleChange.hh" class DummyChargeFlipProcess : public G4HadronicProcess { public: @@ -24,11 +15,7 @@ class DummyChargeFlipProcess : public G4HadronicProcess { G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override; - void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override; - - void DumpPhysicsTable(const G4ParticleDefinition& aParticleType); - private: - G4double GetMicroscopicCrossSection(const G4DynamicParticle* aParticle, const G4Element* anElement, G4double aTemp); + G4ParticleChange* fPartChange; }; #endif diff --git a/SimG4Core/CustomPhysics/interface/G4ProcessHelper.h b/SimG4Core/CustomPhysics/interface/G4ProcessHelper.h index 35bf58438b547..b56dc570cf41f 100644 --- a/SimG4Core/CustomPhysics/interface/G4ProcessHelper.h +++ b/SimG4Core/CustomPhysics/interface/G4ProcessHelper.h @@ -36,10 +36,10 @@ class G4ProcessHelper { //Make sure the element is known (for n/p-decision) ReactionProduct GetFinalState(const G4Track& aTrack, G4ParticleDefinition*& aTarget); -private: G4ProcessHelper(const G4ProcessHelper&) = delete; G4ProcessHelper& operator=(const G4ProcessHelper&) = delete; +private: G4double Regge(const double boost); G4double Pom(const double boost); diff --git a/SimG4Core/CustomPhysics/src/CMSDarkPairProductionProcess.cc b/SimG4Core/CustomPhysics/src/CMSDarkPairProductionProcess.cc index 883db9885a7b1..30cf43c329126 100644 --- a/SimG4Core/CustomPhysics/src/CMSDarkPairProductionProcess.cc +++ b/SimG4Core/CustomPhysics/src/CMSDarkPairProductionProcess.cc @@ -27,7 +27,8 @@ CMSDarkPairProductionProcess::CMSDarkPairProductionProcess(G4double df, const G4 CMSDarkPairProductionProcess::~CMSDarkPairProductionProcess() {} G4bool CMSDarkPairProductionProcess::IsApplicable(const G4ParticleDefinition& p) { - return (p.GetParticleType() == "darkpho"); + G4int pdg = std::abs(p.GetPDGEncoding()); + return (pdg == 1023 || pdg == 1072000); } void CMSDarkPairProductionProcess::InitialiseProcess(const G4ParticleDefinition* p) { @@ -38,8 +39,6 @@ void CMSDarkPairProductionProcess::InitialiseProcess(const G4ParticleDefinition* } } -G4double CMSDarkPairProductionProcess::MinPrimaryEnergy(const G4ParticleDefinition*, const G4Material*) { - return 2 * electron_mass_c2; +G4double CMSDarkPairProductionProcess::MinPrimaryEnergy(const G4ParticleDefinition* p, const G4Material*) { + return std::max(2 * CLHEP::electron_mass_c2 - p->GetPDGMass(), 0.0); } - -void CMSDarkPairProductionProcess::PrintInfo() {} diff --git a/SimG4Core/CustomPhysics/src/CMSSIMPInelasticProcess.cc b/SimG4Core/CustomPhysics/src/CMSSIMPInelasticProcess.cc index 37e473aa756c0..d37fdbb02b0f2 100644 --- a/SimG4Core/CustomPhysics/src/CMSSIMPInelasticProcess.cc +++ b/SimG4Core/CustomPhysics/src/CMSSIMPInelasticProcess.cc @@ -18,7 +18,6 @@ #include "G4HadronicProcessStore.hh" #include "G4HadronicInteraction.hh" -#include "G4HadronInelasticDataSet.hh" #include "G4ParticleDefinition.hh" ////////////////////////////////////////////////////////////////// diff --git a/SimG4Core/CustomPhysics/src/CustomPDGParser.cc b/SimG4Core/CustomPhysics/src/CustomPDGParser.cc index bd88ea236ae5d..6c94db7c9048b 100644 --- a/SimG4Core/CustomPhysics/src/CustomPDGParser.cc +++ b/SimG4Core/CustomPhysics/src/CustomPDGParser.cc @@ -1,12 +1,6 @@ #include -//#include #include -/*CustomPDGParser::CustomPDGParser(int pdgCode) : m_pdgCode(pdgCode) -{ - -}*/ - bool CustomPDGParser::s_isRHadron(int pdg) { int pdgAbs = abs(pdg); return ((pdgAbs % 100000 / 10000 == 9) || (pdgAbs % 10000 / 1000 == 9) || s_isRGlueball(pdg)); @@ -39,7 +33,7 @@ bool CustomPDGParser::s_isRGlueball(int pdg) { bool CustomPDGParser::s_isDphoton(int pdg) { int pdgAbs = abs(pdg); - return (pdgAbs == 1072000); + return (pdgAbs == 1072000) || (pdgAbs == 1023); } bool CustomPDGParser::s_isRMeson(int pdg) { diff --git a/SimG4Core/CustomPhysics/src/CustomPhysics.cc b/SimG4Core/CustomPhysics/src/CustomPhysics.cc index 1c9180a521801..ac502c89fe49a 100644 --- a/SimG4Core/CustomPhysics/src/CustomPhysics.cc +++ b/SimG4Core/CustomPhysics/src/CustomPhysics.cc @@ -1,7 +1,8 @@ #include "SimG4Core/CustomPhysics/interface/CustomPhysics.h" #include "SimG4Core/CustomPhysics/interface/CustomPhysicsList.h" #include "SimG4Core/CustomPhysics/interface/CustomPhysicsListSS.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" +#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -11,7 +12,6 @@ #include "G4HadronElasticPhysics.hh" #include "G4NeutronTrackingCut.hh" -#include "G4HadronPhysicsFTFP_BERT.hh" #include "G4SystemOfUnits.hh" CustomPhysics::CustomPhysics(const edm::ParameterSet& p) : PhysicsList(p) { @@ -24,7 +24,7 @@ CustomPhysics::CustomPhysics(const edm::ParameterSet& p) : PhysicsList(p) { << "CustomPhysicsList " << ssPhys << " for exotics; " << " tracking cut " << tracking << " t(ns)= " << timeLimit / ns; // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics RegisterPhysics(new G4EmExtraPhysics(ver)); @@ -36,7 +36,7 @@ CustomPhysics::CustomPhysics(const edm::ParameterSet& p) : PhysicsList(p) { RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new G4HadronPhysicsFTFP_BERT(ver)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(ver)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); diff --git a/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc b/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc index 67b54495dd60d..93aee63e50f41 100644 --- a/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc +++ b/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc @@ -67,7 +67,7 @@ void CustomPhysicsList::ConstructProcess() { theQGSPSIMPB->Build(simpInelPr); pmanager->AddDiscreteProcess(simpInelPr); } else - edm::LogInfo("CustomPhysics") << " No pmanager"; + edm::LogVerbatim("CustomPhysics") << " No pmanager"; } CustomParticle* cp = dynamic_cast(particle); diff --git a/SimG4Core/CustomPhysics/src/DummyChargeFlipProcess.cc b/SimG4Core/CustomPhysics/src/DummyChargeFlipProcess.cc index 13d746dbecb85..026ebc69e4767 100644 --- a/SimG4Core/CustomPhysics/src/DummyChargeFlipProcess.cc +++ b/SimG4Core/CustomPhysics/src/DummyChargeFlipProcess.cc @@ -1,44 +1,29 @@ +#include "SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h" + #include #include "G4ParticleTable.hh" #include "Randomize.hh" - -#include "SimG4Core/CustomPhysics/interface/DummyChargeFlipProcess.h" +#include "G4NeutronElasticXS.hh" +#include "G4Step.hh" +#include "G4TrackStatus.hh" +#include "G4Element.hh" using namespace CLHEP; -DummyChargeFlipProcess::DummyChargeFlipProcess(const G4String& processName) : G4HadronicProcess(processName) { - AddDataSet(new G4HadronElasticDataSet); +DummyChargeFlipProcess::DummyChargeFlipProcess(const G4String& pname) : G4HadronicProcess(pname, fHadronic) { + AddDataSet(new G4NeutronElasticXS()); + fPartChange = new G4ParticleChange(); } -DummyChargeFlipProcess::~DummyChargeFlipProcess() {} - -void DummyChargeFlipProcess::BuildPhysicsTable(const G4ParticleDefinition& aParticleType) { - if (!G4HadronicProcess::GetCrossSectionDataStore()) { - return; - } - G4HadronicProcess::GetCrossSectionDataStore()->BuildPhysicsTable(aParticleType); -} - -G4double DummyChargeFlipProcess::GetMicroscopicCrossSection(const G4DynamicParticle* /*aParticle*/, - const G4Element* element, - G4double /*aTemp*/) { - return 30 * millibarn * element->GetN(); -} +DummyChargeFlipProcess::~DummyChargeFlipProcess() { delete fPartChange; } G4bool DummyChargeFlipProcess::IsApplicable(const G4ParticleDefinition& aParticleType) { - if (aParticleType.GetParticleType() == "rhadron") - return true; - else - return false; + return (aParticleType.GetParticleType() == "rhadron"); } -void DummyChargeFlipProcess::DumpPhysicsTable(const G4ParticleDefinition& /*aParticleType*/) {} - -G4VParticleChange* DummyChargeFlipProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& /*aStep*/) { - G4ParticleChange* pc = new G4ParticleChange(); - pc->Initialize(aTrack); +G4VParticleChange* DummyChargeFlipProcess::PostStepDoIt(const G4Track& aTrack, const G4Step&) { + fPartChange->Initialize(aTrack); const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); - //G4ParticleDefinition* aParticleDef = aParticle->GetDefinition(); G4double ParentEnergy = aParticle->GetTotalEnergy(); const G4ThreeVector& ParentDirection(aParticle->GetMomentumDirection()); @@ -47,7 +32,7 @@ G4VParticleChange* DummyChargeFlipProcess::PostStepDoIt(const G4Track& aTrack, c G4double finalGlobalTime = aTrack.GetGlobalTime(); G4int numberOfSecondaries = 1; - pc->SetNumberOfSecondaries(numberOfSecondaries); + fPartChange->SetNumberOfSecondaries(numberOfSecondaries); const G4TouchableHandle& thand = aTrack.GetTouchableHandle(); // get current position of the track @@ -63,7 +48,7 @@ G4VParticleChange* DummyChargeFlipProcess::PostStepDoIt(const G4Track& aTrack, c else newType = particleTable->FindParticle(1009113); - G4cout << "RHADRON: New charge = " << newType->GetPDGCharge() << G4endl; + //G4cout << "RHADRON: New charge = " << newType->GetPDGCharge() << G4endl; G4DynamicParticle* newP = new G4DynamicParticle(newType, ParentDirection, ParentEnergy); G4Track* secondary = new G4Track(newP, finalGlobalTime, aTrack.GetPosition()); @@ -71,14 +56,14 @@ G4VParticleChange* DummyChargeFlipProcess::PostStepDoIt(const G4Track& aTrack, c secondary->SetGoodForTrackingFlag(); secondary->SetTouchableHandle(thand); // add the secondary track in the List - pc->AddSecondary(secondary); + fPartChange->AddSecondary(secondary); // Kill the parent particle - pc->ProposeTrackStatus(fStopAndKill); - pc->ProposeLocalEnergyDeposit(energyDeposit); - pc->ProposeGlobalTime(finalGlobalTime); - // Clear NumberOfInteractionLengthLeft + fPartChange->ProposeTrackStatus(fStopAndKill); + fPartChange->ProposeLocalEnergyDeposit(energyDeposit); + fPartChange->ProposeGlobalTime(finalGlobalTime); + ClearNumberOfInteractionLengthLeft(); - return pc; + return fPartChange; } diff --git a/SimG4Core/CustomPhysics/src/FullModelHadronicProcess.cc b/SimG4Core/CustomPhysics/src/FullModelHadronicProcess.cc index 1b59f3679afc1..61412807f58e5 100644 --- a/SimG4Core/CustomPhysics/src/FullModelHadronicProcess.cc +++ b/SimG4Core/CustomPhysics/src/FullModelHadronicProcess.cc @@ -1,6 +1,6 @@ -#include "G4HadReentrentException.hh" #include "G4ProcessManager.hh" #include "G4ParticleTable.hh" +#include "G4HadronicException.hh" #include "SimG4Core/CustomPhysics/interface/FullModelHadronicProcess.h" #include "SimG4Core/CustomPhysics/interface/G4ProcessHelper.h" @@ -594,9 +594,10 @@ void FullModelHadronicProcess::CalculateMomenta( targetHasChanged, leadFlag, leadingStrangeParticle); - } catch (G4HadReentrentException& aC) { - aC.Report(G4cout); - throw G4HadReentrentException(__FILE__, __LINE__, "Failing to calculate momenta"); + } catch (G4HadronicException& aR) { + G4ExceptionDescription ed; + aR.Report(ed); + G4Exception("FullModelHadronicProcess::CalculateMomenta", "had066", FatalException, ed); } } if (finishedTwoClu) { diff --git a/SimG4Core/CustomPhysics/src/FullModelReactionDynamics.cc b/SimG4Core/CustomPhysics/src/FullModelReactionDynamics.cc index d145c051c2c01..a8132b19ae9cc 100644 --- a/SimG4Core/CustomPhysics/src/FullModelReactionDynamics.cc +++ b/SimG4Core/CustomPhysics/src/FullModelReactionDynamics.cc @@ -53,8 +53,6 @@ #include "G4AntiNeutron.hh" #include "Randomize.hh" #include -#include "G4HadReentrentException.hh" -#include #include "G4ParticleTable.hh" using namespace CLHEP; @@ -405,10 +403,9 @@ G4bool FullModelReactionDynamics::GenerateXandPt( for (G4int i = 0; i < vecLen; i++) delete vec[i]; vecLen = 0; - throw G4HadReentrentException( - __FILE__, - __LINE__, - "FullModelReactionDynamics::GenerateXandPt : a pion has been counted as a backward nucleon"); + G4ExceptionDescription ed; + ed << "FullModelReactionDynamics::GenerateXandPt : a pion has been counted as a backward nucleon"; + G4Exception("FullModelReactionDynamics::GenerateXandPt", "had064", FatalException, ed); } vec[i]->SetSide(-3); ++backwardNucleonCount; @@ -1339,8 +1336,9 @@ G4bool FullModelReactionDynamics::TwoCluster( for (G4int i = 0; i < vecLen; i++) delete vec[i]; vecLen = 0; - throw G4HadReentrentException( - __FILE__, __LINE__, "FullModelReactionDynamics::TwoCluster: Negative number of particles"); + G4ExceptionDescription ed; + ed << "Negative number of particles"; + G4Exception("FullModelReactionDynamics::TwoCluster", "had064", FatalException, ed); } delete vec[vecLen - 1]; delete vec[vecLen - 2]; diff --git a/SimG4Core/GFlash/plugins/GFlash.cc b/SimG4Core/GFlash/plugins/GFlash.cc index 5e70ac8901c86..7b34822d21f2e 100644 --- a/SimG4Core/GFlash/plugins/GFlash.cc +++ b/SimG4Core/GFlash/plugins/GFlash.cc @@ -1,12 +1,12 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimG4Core/GFlash/interface/GFlash.h" #include "SimG4Core/GFlash/interface/ParametrisedPhysics.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95msc93.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" +#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" #include "G4DecayPhysics.hh" #include "G4EmExtraPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4HadronPhysicsQGSP_FTFP_BERT.hh" #include "G4IonPhysics.hh" #include "G4NeutronTrackingCut.hh" #include "G4StoppingPhysics.hh" @@ -30,7 +30,7 @@ GFlash::GFlash(const edm::ParameterSet &p) : PhysicsList(p), thePar(p.getParamet if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysics95msc93("EM standard msc93", ver, region)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics RegisterPhysics(new G4EmExtraPhysics(ver)); @@ -44,7 +44,7 @@ GFlash::GFlash(const edm::ParameterSet &p) : PhysicsList(p), thePar(p.getParamet RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new G4HadronPhysicsQGSP_FTFP_BERT(ver)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(ver)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); diff --git a/SimG4Core/Generators/src/Generator.cc b/SimG4Core/Generators/src/Generator.cc index 8020681f65aa3..85a4495d72d55 100644 --- a/SimG4Core/Generators/src/Generator.cc +++ b/SimG4Core/Generators/src/Generator.cc @@ -152,7 +152,8 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) { for (pitr = (*vitr)->particles_begin(HepMC::children); pitr != (*vitr)->particles_end(HepMC::children); ++pitr) { // For purposes of this function, the status is defined as follows: // 1: particles are not decayed by generator - // 2: particles are decayed by generator but need to be propagated by + // 2: particles are decayed by generator but need to be propagated by GEANT + // 3: particles are decayed by generator and do not need to be propagated by GEANT int status = (*pitr)->status(); int pdg = (*pitr)->pdg_id(); if (status > 3 && isExotic(pdg) && (!(isExoticNonDetectable(pdg)))) { @@ -163,6 +164,9 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) { // be propagated by GEANT, so do not change their status code. status = 2; } + if (status == 2 && abs(pdg) == 9900015) { + status = 3; + } // Particles which are not decayed by generator if (status == 1) { @@ -244,6 +248,9 @@ void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) { if (status > 3 && isExotic(pdg) && (!(isExoticNonDetectable(pdg)))) { status = hasDecayVertex ? 2 : 1; } + if (status == 2 && abs(pdg) == 9900015) { + status = 3; + } // this particle has predefined decay but has no vertex if (2 == status && !hasDecayVertex) { diff --git a/SimG4Core/PhysicsLists/doc/PhysicsLists.doc b/SimG4Core/PhysicsLists/doc/PhysicsLists.doc index 367c69a8a97dd..7fb8ad27ec922 100755 --- a/SimG4Core/PhysicsLists/doc/PhysicsLists.doc +++ b/SimG4Core/PhysicsLists/doc/PhysicsLists.doc @@ -23,32 +23,32 @@ components provided by Geant4. - CMSEmNoDeltaRay - obsolete EM physics -- CMSEmStandardPhysics - Option1 with custom msc: e+e- msc below 100 MeV - by UrbanMscModel93, muons, pions, kaons, protons, - anti_proton G4WentzelVIModel+G4eSingleScattering -- CMSEmStandardPhysics95 - Option1 with custom msc: G4UrbanMscModel for all -- CMSEmStandardPhysics95msc93 - Option1 with custom msc configuration: electron msc by - UrbanMscModel93, muon msc by G4UrbanMscModel -- CMSEmStandardPhysicsLPM - Option1 with custom msc configuration: electron msc by - UrbanMscModel93, muon msc by combined - G4WentzelVIModel+G4eSingleScattering +- CMSEmStandardPhysics - EMM customised electromagnetic (EM) physics + configuration based on Geant4 10.7 EM configuration + option1 with custom msc: e+e- msc below 100 MeV + by the default Urban model for HCal and HGCal +- CMSEmStandardPhysicsLPM - EMM customised electromagnetic (EM) physics + configuration based on Geant4 10.6 EM configuration + option1 with custom msc: e+e- msc below 100 MeV + by the default Urban model for HCal and HGCal +- CMSEmStandardPhysicsXS - EMN customised electromagnetic (EM) physics + configuration based on Geant4 10.7 EM configuration + option4 with custom msc: e+e- msc below 100 MeV + by the default Urban model for HCal and HGCal - CMSMonopolePhysics - extra constructor of magnetic monopole physics - DummyEMPhysics - constructor where only electron and mu- ionisation are defined -- HadronPhysicsCMS - constructor of hadron inelastic physics by name, - likely obsolete +- CMSHadronPhysicsFTFP_BERT - custom constructor of CMS hadron inelastic + physics based on Geant4 10.7 + - HadronPhysicsQGSPCMS_FTFP_BERT - castom QGSP_FTFP_BERT hadron inelastic - physics created on top of Geant4 9.4, - hyperons are simulated with LHEP -- UrbanMscModel93 - copied from G4eant4 9.6p03 to be used with Geant4 10.X + physics created on top of Geant4 10.7 \subsection pluginai Plugins -QGSPCMS_FTFP_BERT_EML - use CMSEmStandardPhysics -QGSPCMS_FTFP_BERT_EML95 - use CMSEmStandardPhysics95 -QGSPCMS_FTFP_BERT_EML95msc93- use CMSEmStandardPhysics95msc93 and local - HadronPhysicsQGSPCMS_FTFP_BERT -QGSPCMS_FTFP_BERT_EML_New - G4EmStandardPhysics_option1 +FTFPCMS_BERT_EMM - use CMSEmStandardPhysics +FTFPCMS_BERT_EMN - use CMSEmStandardPhysicsXS +QGSPCMS_FTFP_BERT_EML - use G4EmStandardPhysics_option1 \subsection modules Modules @@ -66,4 +66,3 @@ Unknown Last updated: @DATE@ Author: computer-generated. */ - diff --git a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h index 2c268d6368fbd..be2ed699bd144 100644 --- a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h +++ b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h @@ -1,18 +1,33 @@ +//-------------------------------------------------------------------- +// +// 15.04.2021 V.Ivanchenko EM physics of CMS mirgrated to Geant4 10.7 +// based on option1 Geant4 EM and called EMM +// +//-------------------------------------------------------------------- + #ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysics_h #define SimG4Core_PhysicsLists_CMSEmStandardPhysics_h #include "G4VPhysicsConstructor.hh" #include "globals.hh" +#include "G4MscStepLimitType.hh" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" class CMSEmStandardPhysics : public G4VPhysicsConstructor { public: - CMSEmStandardPhysics(G4int ver); + CMSEmStandardPhysics(G4int ver, const edm::ParameterSet& p); ~CMSEmStandardPhysics() override; void ConstructParticle() override; void ConstructProcess() override; private: + G4double fRangeFactor; + G4double fGeomFactor; + G4double fSafetyFactor; + G4double fLambdaLimit; + G4MscStepLimitType fStepLimitType; G4int verbose; }; diff --git a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95.h b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95.h deleted file mode 100644 index 343efda26142e..0000000000000 --- a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysics95_h -#define SimG4Core_PhysicsLists_CMSEmStandardPhysics95_h - -#include "G4VPhysicsConstructor.hh" -#include "globals.hh" -#include - -class CMSEmStandardPhysics95 : public G4VPhysicsConstructor { -public: - CMSEmStandardPhysics95(const G4String& name, G4int ver, const std::string& reg); - ~CMSEmStandardPhysics95() override; - - void ConstructParticle() override; - void ConstructProcess() override; - -private: - G4int verbose; - std::string region; -}; - -#endif diff --git a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95msc93.h b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95msc93.h deleted file mode 100644 index 404ade7a048f8..0000000000000 --- a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95msc93.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysics95msc93_h -#define SimG4Core_PhysicsLists_CMSEmStandardPhysics95msc93_h - -#include "G4VPhysicsConstructor.hh" -#include "globals.hh" -#include - -class CMSEmStandardPhysics95msc93 : public G4VPhysicsConstructor { -public: - CMSEmStandardPhysics95msc93(const G4String& name, G4int ver, const std::string& reg); - ~CMSEmStandardPhysics95msc93() override; - - void ConstructParticle() override; - void ConstructProcess() override; - -private: - G4int verbose; - std::string region; -}; - -#endif diff --git a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h index 269869aba8be8..bb3cef3389ad6 100644 --- a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h +++ b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h @@ -1,3 +1,11 @@ +//-------------------------------------------------------------------- +// +// 10.06.2018 V.Ivanchenko EM physics of CMS mirgrated to Geant4 10.6 +// based on option1 Geant4 EM and called EMM +// 15.04.2021 Become legacy and will retire soon +// +//-------------------------------------------------------------------- + #ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysicsLPM_h #define SimG4Core_PhysicsLists_CMSEmStandardPhysicsLPM_h diff --git a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h index d0a9b520d81a2..a3c00879965eb 100644 --- a/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h +++ b/SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h @@ -1,18 +1,33 @@ +//-------------------------------------------------------------------- +// +// 15.04.2021 V.Ivanchenko EM physics of CMS mirgrated to Geant4 10.7 +// based on option1 Geant4 EM and called EMN +// +//-------------------------------------------------------------------- + #ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysicsXS_h #define SimG4Core_PhysicsLists_CMSEmStandardPhysicsXS_h #include "G4VPhysicsConstructor.hh" #include "globals.hh" +#include "G4MscStepLimitType.hh" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" class CMSEmStandardPhysicsXS : public G4VPhysicsConstructor { public: - CMSEmStandardPhysicsXS(G4int ver); + CMSEmStandardPhysicsXS(G4int ver, const edm::ParameterSet& p); ~CMSEmStandardPhysicsXS() override; void ConstructParticle() override; void ConstructProcess() override; private: + G4double fRangeFactor; + G4double fGeomFactor; + G4double fSafetyFactor; + G4double fLambdaLimit; + G4MscStepLimitType fStepLimitType; G4int verbose; }; diff --git a/SimG4Core/PhysicsLists/interface/CMSFTFPNeutronBuilder.hh b/SimG4Core/PhysicsLists/interface/CMSFTFPNeutronBuilder.hh deleted file mode 100644 index 87e447a23a2ed..0000000000000 --- a/SimG4Core/PhysicsLists/interface/CMSFTFPNeutronBuilder.hh +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef SimG4Core_PhysicsLists_CMSFTFPNeutronBuilder_h -#define SimG4Core_PhysicsLists_CMSFTFPNeutronBuilder_h 1 - -#include "globals.hh" - -#include "G4HadronElasticProcess.hh" -#include "G4HadronFissionProcess.hh" -#include "G4HadronCaptureProcess.hh" -#include "G4NeutronInelasticProcess.hh" -#include "G4VNeutronBuilder.hh" - -#include "G4TheoFSGenerator.hh" -#include "G4ExcitationHandler.hh" -#include "G4PreCompoundModel.hh" -#include "G4GeneratorPrecompoundInterface.hh" -#include "G4FTFModel.hh" -#include "G4LundStringFragmentation.hh" -#include "G4ExcitedStringDecay.hh" -#include "G4QuasiElasticChannel.hh" - -class CMSFTFPNeutronBuilder : public G4VNeutronBuilder { -public: - CMSFTFPNeutronBuilder(G4bool quasiElastic = false); - ~CMSFTFPNeutronBuilder() override; - -public: - void Build(G4HadronElasticProcess* aP) override; - void Build(G4HadronFissionProcess* aP) override; - void Build(G4HadronCaptureProcess* aP) override; - void Build(G4NeutronInelasticProcess* aP) override; - - void SetMinEnergy(G4double aM) override { theMin = aM; } - void SetMaxEnergy(G4double aM) override { theMax = aM; } - -private: - G4TheoFSGenerator* theModel; - G4PreCompoundModel* thePreEquilib; - G4GeneratorPrecompoundInterface* theCascade; - G4FTFModel* theStringModel; - G4ExcitedStringDecay* theStringDecay; - G4QuasiElasticChannel* theQuasiElastic; - - G4double theMin; - G4double theMax; -}; - -// 2002 by J.P. Wellisch - -#endif diff --git a/SimG4Core/PhysicsLists/interface/CMSFTFPPiKBuilder.hh b/SimG4Core/PhysicsLists/interface/CMSFTFPPiKBuilder.hh deleted file mode 100644 index 73b07edec8082..0000000000000 --- a/SimG4Core/PhysicsLists/interface/CMSFTFPPiKBuilder.hh +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef SimG4Core_PhysicsLists_CMSFTFPPiKBuilder_h -#define SimG4Core_PhysicsLists_CMSFTFPPiKBuilder_h 1 - -#include "globals.hh" - -#include "G4HadronElasticProcess.hh" -#include "G4HadronFissionProcess.hh" -#include "G4HadronCaptureProcess.hh" -#include "G4NeutronInelasticProcess.hh" -#include "G4VPiKBuilder.hh" - -#include "G4TheoFSGenerator.hh" -#include "G4ExcitationHandler.hh" -#include "G4PreCompoundModel.hh" -#include "G4GeneratorPrecompoundInterface.hh" -#include "G4FTFModel.hh" -#include "G4LundStringFragmentation.hh" -#include "G4ExcitedStringDecay.hh" -#include "G4QuasiElasticChannel.hh" - -#include "G4PiNuclearCrossSection.hh" - -class CMSFTFPPiKBuilder : public G4VPiKBuilder { -public: - CMSFTFPPiKBuilder(G4bool quasiElastic = false); - ~CMSFTFPPiKBuilder() override; - -public: - void Build(G4HadronElasticProcess* aP) override; - void Build(G4PionPlusInelasticProcess* aP) override; - void Build(G4PionMinusInelasticProcess* aP) override; - void Build(G4KaonPlusInelasticProcess* aP) override; - void Build(G4KaonMinusInelasticProcess* aP) override; - void Build(G4KaonZeroLInelasticProcess* aP) override; - void Build(G4KaonZeroSInelasticProcess* aP) override; - - void SetMinEnergy(G4double aM) override { theMin = aM; } - void SetMaxEnergy(G4double aM) override { theMax = aM; } - -private: - G4TheoFSGenerator* theModel; - G4PreCompoundModel* thePreEquilib; - G4GeneratorPrecompoundInterface* theCascade; - G4FTFModel* theStringModel; - G4ExcitedStringDecay* theStringDecay; - G4QuasiElasticChannel* theQuasiElastic; - - G4PiNuclearCrossSection* thePiData; - G4double theMin; - G4double theMax; -}; - -// 2002 by J.P. Wellisch - -#endif diff --git a/SimG4Core/PhysicsLists/interface/CMSFTFPProtonBuilder.hh b/SimG4Core/PhysicsLists/interface/CMSFTFPProtonBuilder.hh deleted file mode 100644 index d04cbb79b7f3c..0000000000000 --- a/SimG4Core/PhysicsLists/interface/CMSFTFPProtonBuilder.hh +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef SimG4Core_PhysicsLists_CMSFTFPProtonBuilder_h -#define SimG4Core_PhysicsLists_CMSFTFPProtonBuilder_h - -#include "globals.hh" - -#include "G4HadronElasticProcess.hh" -#include "G4HadronFissionProcess.hh" -#include "G4HadronCaptureProcess.hh" -#include "G4ProtonInelasticProcess.hh" -#include "G4VProtonBuilder.hh" - -#include "G4TheoFSGenerator.hh" -#include "G4ExcitationHandler.hh" -#include "G4PreCompoundModel.hh" -#include "G4GeneratorPrecompoundInterface.hh" -#include "G4FTFModel.hh" -#include "G4LundStringFragmentation.hh" -#include "G4ExcitedStringDecay.hh" -#include "G4QuasiElasticChannel.hh" - -class CMSFTFPProtonBuilder : public G4VProtonBuilder { -public: - CMSFTFPProtonBuilder(G4bool quasiElastic = false); - ~CMSFTFPProtonBuilder() override; - -public: - void Build(G4HadronElasticProcess* aP) override; - void Build(G4ProtonInelasticProcess* aP) override; - - void SetMinEnergy(G4double aM) override { theMin = aM; } - void SetMaxEnergy(G4double aM) override { theMax = aM; } - -private: - G4TheoFSGenerator* theModel; - G4PreCompoundModel* thePreEquilib; - G4GeneratorPrecompoundInterface* theCascade; - G4FTFModel* theStringModel; - G4ExcitedStringDecay* theStringDecay; - G4QuasiElasticChannel* theQuasiElastic; - - G4double theMin; - G4double theMax; -}; - -// 2002 by J.P. Wellisch - -#endif diff --git a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h index 1409d40dde967..68bc7d70abd3c 100644 --- a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h +++ b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h @@ -2,10 +2,14 @@ // Author: Vladimir Ivanchenko // Date: March 2018 // -// Hadron physics for the new CMS physics list FTFP_BERT_EMM_TRK. +// Hadron inelastic physics for the new CMS physics list FTFP_BERT. // The hadron physics of FTFP_BERT has the transition between Bertini -// (BERT) intra-nuclear cascade model and Fritiof (FTF) string model in the -// energy region [4, 5] GeV (instead of the default for Geant4 10.4). +// (BERT) intra-nuclear cascade model and Fritiof (FTF) string model +// optimized for CMS. +// +// 15.04.2021 V.Ivanchenko Hadron inelastic physics of CMS +// mirgrated to Geant4 10.7 +// //--------------------------------------------------------------------------- // #ifndef SimG4Core_PhysicsLists_CMSHadronPhysicsFTFP_BERT_h @@ -14,32 +18,19 @@ #include "globals.hh" #include "G4ios.hh" -#include "G4VPhysicsConstructor.hh" +#include "G4HadronPhysicsFTFP_BERT.hh" -class CMSHadronPhysicsFTFP_BERT : public G4VPhysicsConstructor { +class CMSHadronPhysicsFTFP_BERT : public G4HadronPhysicsFTFP_BERT { public: explicit CMSHadronPhysicsFTFP_BERT(G4int verb); explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3); ~CMSHadronPhysicsFTFP_BERT() override; - void ConstructParticle() override; void ConstructProcess() override; -private: - //This calls the specific ones for the different particles in order - void CreateModels(); - void Neutron(); - void Proton(); - void Pion(); - void Kaon(); - void Others(); - void DumpBanner(); - //This contains extra configurataion specific to this PL - void ExtraConfiguration(); - - G4double minFTFP_; - G4double maxBERT_; - G4double maxBERTpi_; + // copy constructor and hide assignment operator + CMSHadronPhysicsFTFP_BERT(CMSHadronPhysicsFTFP_BERT &) = delete; + CMSHadronPhysicsFTFP_BERT &operator=(const CMSHadronPhysicsFTFP_BERT &right) = delete; }; #endif diff --git a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h new file mode 100644 index 0000000000000..91f360b379631 --- /dev/null +++ b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h @@ -0,0 +1,45 @@ +//--------------------------------------------------------------------------- +// Author: Vladimir Ivanchenko +// Date: March 2018 +// +// Hadron physics for the new CMS physics list FTFP_BERT_EMM_TRK. +// The hadron physics of FTFP_BERT has the transition between Bertini +// (BERT) intra-nuclear cascade model and Fritiof (FTF) string model in the +// energy region [4, 5] GeV (instead of the default for Geant4 10.4). +//--------------------------------------------------------------------------- +// +#ifndef SimG4Core_PhysicsLists_CMSHadronPhysicsFTFP_BERT106_h +#define SimG4Core_PhysicsLists_CMSHadronPhysicsFTFP_BERT106_h + +#include "globals.hh" +#include "G4ios.hh" + +#include "G4VPhysicsConstructor.hh" + +class CMSHadronPhysicsFTFP_BERT106 : public G4VPhysicsConstructor { +public: + explicit CMSHadronPhysicsFTFP_BERT106(G4int verb); + explicit CMSHadronPhysicsFTFP_BERT106(G4double e1, G4double e2, G4double e3); + ~CMSHadronPhysicsFTFP_BERT106() override; + + void ConstructParticle() override; + void ConstructProcess() override; + +private: + //This calls the specific ones for the different particles in order + void CreateModels(); + void Neutron(); + void Proton(); + void Pion(); + void Kaon(); + void Others(); + void DumpBanner(); + //This contains extra configurataion specific to this PL + void ExtraConfiguration(); + + G4double minFTFP_; + G4double maxBERT_; + G4double maxBERTpi_; +}; + +#endif diff --git a/SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h b/SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h index 100062c6a543f..f7899ddae5aa1 100644 --- a/SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h +++ b/SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h @@ -1,37 +1,29 @@ +//-------------------------------------------------------------------- +// +// 15.04.2021 V.Ivanchenko Hadron inelastic physics based on +// QGSP_FTFP_BERT of CMS migrated to Geant4 10.7 +// +//-------------------------------------------------------------------- + #ifndef SimG4Core_PhysicsLists_HadronPhysicsQGSPCMS_FTFP_BERT_h #define SimG4Core_PhysicsLists_HadronPhysicsQGSPCMS_FTFP_BERT_h 1 #include "globals.hh" #include "G4ios.hh" -#include "G4VPhysicsConstructor.hh" +#include "G4HadronPhysicsQGSP_BERT.hh" -class HadronPhysicsQGSPCMS_FTFP_BERT : public G4VPhysicsConstructor { +class HadronPhysicsQGSPCMS_FTFP_BERT : public G4HadronPhysicsQGSP_BERT { public: explicit HadronPhysicsQGSPCMS_FTFP_BERT(G4int verbose); explicit HadronPhysicsQGSPCMS_FTFP_BERT(G4double e1, G4double e2, G4double e3, G4double e4, G4double e5); ~HadronPhysicsQGSPCMS_FTFP_BERT() override; - void ConstructParticle() override; void ConstructProcess() override; -private: - //This calls the specific ones for the different particles in order - void CreateModels(); - void Neutron(); - void Proton(); - void Pion(); - void Kaon(); - void Others(); - void DumpBanner(); - //This contains extra configurataion specific to this PL - void ExtraConfiguration(); - - G4double minFTFP_; - G4double maxBERT_; - G4double minQGSP_; - G4double maxFTFP_; - G4double maxBERTpi_; + // copy constructor and hide assignment operator + HadronPhysicsQGSPCMS_FTFP_BERT(HadronPhysicsQGSPCMS_FTFP_BERT &) = delete; + HadronPhysicsQGSPCMS_FTFP_BERT &operator=(const HadronPhysicsQGSPCMS_FTFP_BERT &right) = delete; }; #endif diff --git a/SimG4Core/PhysicsLists/interface/UrbanMscModel93.h b/SimG4Core/PhysicsLists/interface/UrbanMscModel93.h deleted file mode 100644 index e84f6688ccc48..0000000000000 --- a/SimG4Core/PhysicsLists/interface/UrbanMscModel93.h +++ /dev/null @@ -1,232 +0,0 @@ -// ------------------------------------------------------------------- -// -// -// GEANT4 Class header file -// -// -// File name: UrbanMscModel93 -// -// Original author: Laszlo Urban, -// -// V.Ivanchenko have copied from G4UrbanMscModel93 class -// of Geant4 global tag geant4-09-06-ref-07 -// and have adopted to CMSSW -// -// Creation date: 21.08.2013 -// -// Class Description: -// -// Implementation of the model of multiple scattering based on -// H.W.Lewis Phys Rev 78 (1950) 526 -// L.Urban CERN-OPEN-2006-077, Dec. 2006 -// V.N.Ivanchenko et al., J.Phys: Conf. Ser. 219 (2010) 032045 - -// ------------------------------------------------------------------- -// In its present form the model can be used for simulation -// of the e-/e+, muon and charged hadron multiple scattering -// -// This code was copied from Geant4 at the moment when it was removed -// from Geant4 completly (together with G4UrbanMscModel91, 95, 96). -// Since that time Geant4 supports the unique class G4UrbanMscModel. -// It was shown in Geant4 internal validations that this last class -// provides more accurate simulation for various thin target tests. -// This main Geant4 model does is not provide exactly the same results -// for CMS calorimeters run1 versus run2. To keep calorimeter response -// unchanged, CMS private version of the Urban model was created. It is -// basically the the same model used for run1 but it includes several -// technical fixed introduced after run1. There fixes do not change -// results but allow to avoid numerical problems for very small steps -// and to improve a bit of the CPU performance. -// - -#ifndef SimG4Core_PhysicsLists_UrbanMscModel93_h -#define SimG4Core_PhysicsLists_UrbanMscModel93_h 1 - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -#include "G4VMscModel.hh" -#include "G4MscStepLimitType.hh" -#include "G4Log.hh" -#include "G4Exp.hh" -#include "CLHEP/Units/SystemOfUnits.h" - -class G4ParticleChangeForMSC; -class G4SafetyHelper; -class G4LossTableManager; - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -class UrbanMscModel93 : public G4VMscModel { -public: - UrbanMscModel93(const G4String& nam = "UrbanMsc93"); - - ~UrbanMscModel93() override; - - void Initialise(const G4ParticleDefinition*, const G4DataVector&) override; - - void StartTracking(G4Track*) override; - - G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle, - G4double KineticEnergy, - G4double AtomicNumber, - G4double AtomicWeight = 0., - G4double cut = 0., - G4double emax = DBL_MAX) override; - - G4ThreeVector& SampleScattering(const G4ThreeVector&, G4double safety) override; - - G4double ComputeTruePathLengthLimit(const G4Track& track, G4double& currentMinimalStep) override; - - G4double ComputeGeomPathLength(G4double truePathLength) override; - - G4double ComputeTrueStepLength(G4double geomStepLength) override; - - inline G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy); - -private: - G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy); - - G4double SampleDisplacement(); - - G4double LatCorrelation(); - - inline void SetParticle(const G4ParticleDefinition*); - - inline void UpdateCache(); - - inline G4double SimpleScattering(G4double xmeanth, G4double x2meanth); - - // hide assignment operator - UrbanMscModel93& operator=(const UrbanMscModel93& right) = delete; - UrbanMscModel93(const UrbanMscModel93&) = delete; - - const G4ParticleDefinition* particle; - G4ParticleChangeForMSC* fParticleChange; - - const G4MaterialCutsCouple* couple; - G4LossTableManager* theManager; - - G4double mass; - G4double charge, ChargeSquare; - G4double masslimite, lambdalimit, fr; - - G4double taubig; - G4double tausmall; - G4double taulim; - G4double currentTau; - G4double tlimit; - G4double tlimitmin; - G4double tlimitminfix; - G4double tgeom; - - G4double geombig; - G4double geommin; - G4double geomlimit; - G4double skindepth; - G4double smallstep; - - G4double presafety; - - G4double lambda0; - G4double lambdaeff; - G4double tPathLength; - G4double zPathLength; - G4double par1, par2, par3; - - G4double stepmin; - - G4double currentKinEnergy; - G4double currentRange; - G4double rangeinit; - G4double currentRadLength; - - G4double numlim, xsi, ea, eaa; - - G4double theta0max, rellossmax; - G4double third; - - G4int currentMaterialIndex; - - G4double y; - G4double Zold; - G4double Zeff, Z2, Z23, lnZ; - G4double coeffth1, coeffth2; - G4double coeffc1, coeffc2; - G4double scr1ini, scr2ini, scr1, scr2; - - G4bool firstStep; - G4bool inside; - G4bool insideskin; -}; - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -inline void UrbanMscModel93::SetParticle(const G4ParticleDefinition* p) { - if (p != particle) { - particle = p; - mass = p->GetPDGMass(); - charge = p->GetPDGCharge() / CLHEP::eplus; - ChargeSquare = charge * charge; - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -inline void UrbanMscModel93::UpdateCache() { - lnZ = G4Log(Zeff); - //new correction in theta0 formula - coeffth1 = (1. - 8.7780e-2 / Zeff) * (0.87 + 0.03 * lnZ); - coeffth2 = (4.0780e-2 + 1.7315e-4 * Zeff) * (0.87 + 0.03 * lnZ); - // tail parameters - G4double lnZ1 = G4Log(Zeff + 1.); - coeffc1 = 2.943 - 0.197 * lnZ1; - coeffc2 = 0.0987 - 0.0143 * lnZ1; - // for single scattering - Z2 = Zeff * Zeff; - Z23 = G4Exp(2. * lnZ / 3.); - scr1 = scr1ini * Z23; - scr2 = scr2ini * Z2 * ChargeSquare; - - Zold = Zeff; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -inline G4double UrbanMscModel93::ComputeTheta0(G4double trueStepLength, G4double KineticEnergy) { - // for all particles take the width of the central part - // from a parametrization similar to the Highland formula - // ( Highland formula: Particle Physics Booklet, July 2002, eq. 26.10) - static const G4double c_highland = 13.6 * CLHEP::MeV; - G4double invbetacp = - sqrt((currentKinEnergy + mass) * (KineticEnergy + mass) / - (currentKinEnergy * (currentKinEnergy + 2. * mass) * KineticEnergy * (KineticEnergy + 2. * mass))); - y = trueStepLength / currentRadLength; - G4double theta0 = c_highland * std::abs(charge) * sqrt(y) * invbetacp; - // correction factor from e- scattering data - theta0 *= (coeffth1 + coeffth2 * G4Log(y)); - - return theta0; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -inline G4double UrbanMscModel93::SimpleScattering(G4double xmeanth, G4double x2meanth) { - // 'large angle scattering' - // 2 model functions with correct xmean and x2mean - G4double a = (2. * xmeanth + 9. * x2meanth - 3.) / (2. * xmeanth - 3. * x2meanth + 1.); - G4double prob = (a + 2.) * xmeanth / a; - - // sampling - G4double cth = 1.; - if (G4UniformRand() < prob) { - cth = -1. + 2. * G4Exp(G4Log(G4UniformRand()) / (a + 1.)); - } else { - cth = -1. + 2. * G4UniformRand(); - } - return cth; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -#endif diff --git a/SimG4Core/PhysicsLists/plugins/DummyPhysics.cc b/SimG4Core/PhysicsLists/plugins/DummyPhysics.cc index ce9ccffc53787..fd43f80a4aeeb 100644 --- a/SimG4Core/PhysicsLists/plugins/DummyPhysics.cc +++ b/SimG4Core/PhysicsLists/plugins/DummyPhysics.cc @@ -11,5 +11,5 @@ DummyPhysics::DummyPhysics(const edm::ParameterSet& p) : PhysicsList(p) { RegisterPhysics(new DummyEMPhysics(ver)); } RegisterPhysics(new G4DecayPhysics(ver)); - edm::LogInfo("PhysicsList") << "DummyPhysics constructed with EM Physics " << emPhys << " and Decay"; + edm::LogVerbatim("PhysicsList") << "DummyPhysics constructed with EM Physics " << emPhys << " and Decay"; } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc index 4d787bf1548a4..11aad9d53634b 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc @@ -1,5 +1,4 @@ #include "FTFPCMS_BERT_EML.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" #include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -10,6 +9,7 @@ #include "G4HadronElasticPhysics.hh" #include "G4NeutronTrackingCut.hh" #include "G4HadronicProcessStore.hh" +#include "G4EmStandardPhysics_option1.hh" FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); @@ -28,7 +28,7 @@ FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc index b022c7d8bc7c7..22d99bcd6afce 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc @@ -1,6 +1,8 @@ #include "FTFPCMS_BERT_EMM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" #include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" +#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -45,7 +47,7 @@ FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT106(minFTFP, maxBERT, maxBERTpi)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc index 14bdf3da9a597..488d1fd53e8ba 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc @@ -1,5 +1,5 @@ #include "FTFPCMS_BERT_EMM_TRK.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -23,7 +23,7 @@ FTFPCMS_BERT_EMM_TRK::FTFPCMS_BERT_EMM_TRK(const edm::ParameterSet& p) : Physics if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc index bbda9e4b6e937..1cf4cb0e6b1ab 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc @@ -28,7 +28,7 @@ FTFPCMS_BERT_EMN::FTFPCMS_BERT_EMN(const edm::ParameterSet& p) : PhysicsList(p) if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsXS(ver)); + RegisterPhysics(new CMSEmStandardPhysicsXS(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EML.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EML.cc index 2d100c6a1bd8f..f436cd5d53ef5 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EML.cc @@ -1,5 +1,4 @@ #include "FTFPCMS_BERT_HP_EML.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4ThermalNeutrons.hh" @@ -12,6 +11,7 @@ #include "G4NeutronTrackingCut.hh" #include "G4HadronicProcessStore.hh" +#include "G4EmStandardPhysics_option1.hh" #include "G4HadronPhysicsFTFP_BERT_HP.hh" FTFPCMS_BERT_HP_EML::FTFPCMS_BERT_HP_EML(const edm::ParameterSet& p) : PhysicsList(p) { @@ -21,14 +21,14 @@ FTFPCMS_BERT_HP_EML::FTFPCMS_BERT_HP_EML(const edm::ParameterSet& p) : PhysicsLi bool tracking = p.getParameter("TrackingCut"); bool thermal = p.getUntrackedParameter("ThermalNeutrons"); double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; - edm::LogInfo("PhysicsList") << "You are using the simulation engine: " - << "FTFP_BERT_HP_EML \n Flags for EM Physics " << emPhys << ", for Hadronic Physics " - << hadPhys << " and tracking cut " << tracking << " t(ns)= " << timeLimit / CLHEP::ns - << " ThermalNeutrons: " << thermal; + edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: " + << "FTFP_BERT_HP_EML \n Flags for EM Physics " << emPhys << ", for Hadronic Physics " + << hadPhys << " and tracking cut " << tracking + << " t(ns)= " << timeLimit / CLHEP::ns << " ThermalNeutrons: " << thermal; if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsXS(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EMM.cc index 60701397b216f..b334cbf5060e8 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_HP_EMM.cc @@ -1,5 +1,5 @@ #include "FTFPCMS_BERT_HP_EMM.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4ThermalNeutrons.hh" @@ -28,7 +28,7 @@ FTFPCMS_BERT_HP_EMM::FTFPCMS_BERT_HP_EMM(const edm::ParameterSet& p) : PhysicsLi if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_XS_EML.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_XS_EML.cc index 2b67896c4fe24..35d155645b542 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_XS_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_XS_EML.cc @@ -1,5 +1,4 @@ #include "FTFPCMS_BERT_XS_EML.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4ThermalNeutrons.hh" @@ -12,6 +11,7 @@ #include "G4NeutronTrackingCut.hh" #include "G4HadronicProcessStore.hh" +#include "G4EmStandardPhysics_option1.hh" #include "G4HadronPhysicsFTFP_BERT.hh" FTFPCMS_BERT_XS_EML::FTFPCMS_BERT_XS_EML(const edm::ParameterSet& p) : PhysicsList(p) { @@ -21,14 +21,14 @@ FTFPCMS_BERT_XS_EML::FTFPCMS_BERT_XS_EML(const edm::ParameterSet& p) : PhysicsLi bool tracking = p.getParameter("TrackingCut"); bool thermal = p.getUntrackedParameter("ThermalNeutrons"); double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; - edm::LogInfo("PhysicsList") << "You are using the simulation engine: " - << "FTFP_BERT_XS_EML \n Flags for EM Physics " << emPhys << ", for Hadronic Physics " - << hadPhys << " and tracking cut " << tracking << " t(ns)= " << timeLimit / CLHEP::ns - << " ThermalNeutrons: " << thermal; + edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: " + << "FTFP_BERT_XS_EML \n Flags for EM Physics " << emPhys << ", for Hadronic Physics " + << hadPhys << " and tracking cut " << tracking + << " t(ns)= " << timeLimit / CLHEP::ns << " ThermalNeutrons: " << thermal; if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsXS(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_EMM.cc index fa81d3b3dac95..1102e817810e8 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_EMM.cc @@ -1,5 +1,5 @@ #include "FTFPCMS_INCLXX_EMM.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -24,7 +24,7 @@ FTFPCMS_INCLXX_EMM::FTFPCMS_INCLXX_EMM(const edm::ParameterSet& p) : PhysicsList if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_HP_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_HP_EMM.cc index 6c5cc9dacea4d..ae8d7cb1435a3 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_HP_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_HP_EMM.cc @@ -1,5 +1,5 @@ #include "FTFPCMS_INCLXX_HP_EMM.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4ThermalNeutrons.hh" @@ -28,7 +28,7 @@ FTFPCMS_INCLXX_HP_EMM::FTFPCMS_INCLXX_HP_EMM(const edm::ParameterSet& p) : Physi if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/QBBCCMS.cc b/SimG4Core/PhysicsLists/plugins/QBBCCMS.cc index 8ae5814db3a71..9d3257f6b80f7 100644 --- a/SimG4Core/PhysicsLists/plugins/QBBCCMS.cc +++ b/SimG4Core/PhysicsLists/plugins/QBBCCMS.cc @@ -1,6 +1,6 @@ #include "QBBCCMS.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "G4EmStandardPhysics.hh" #include "G4DecayPhysics.hh" @@ -26,7 +26,7 @@ QBBCCMS::QBBCCMS(const edm::ParameterSet& p) : PhysicsList(p) { if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_EML.cc b/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_EML.cc index 5d3a09176a965..179eba197fa47 100644 --- a/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_EML.cc @@ -1,5 +1,4 @@ #include "QGSPCMS_BERT_EML.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -9,6 +8,7 @@ #include "G4HadronElasticPhysics.hh" #include "G4NeutronTrackingCut.hh" #include "G4HadronicProcessStore.hh" +#include "G4EmStandardPhysics_option1.hh" #include "G4HadronPhysicsQGSP_BERT.hh" @@ -23,7 +23,7 @@ QGSPCMS_BERT_EML::QGSPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysics(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_HP_EML.cc b/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_HP_EML.cc index 28895f56ef330..adde7f88d0ff6 100644 --- a/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_HP_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/QGSPCMS_BERT_HP_EML.cc @@ -1,5 +1,4 @@ #include "QGSPCMS_BERT_HP_EML.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -9,6 +8,7 @@ #include "G4HadronElasticPhysicsHP.hh" #include "G4NeutronTrackingCut.hh" #include "G4HadronicProcessStore.hh" +#include "G4EmStandardPhysics_option1.hh" #include "G4HadronPhysicsQGSP_BERT_HP.hh" @@ -23,7 +23,7 @@ QGSPCMS_BERT_HP_EML::QGSPCMS_BERT_HP_EML(const edm::ParameterSet& p) : PhysicsLi if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysics(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EML.cc b/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EML.cc index c4318456f97dc..4eb05298da7f2 100644 --- a/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EML.cc @@ -1,5 +1,4 @@ #include "QGSPCMS_FTFP_BERT_EML.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -10,6 +9,7 @@ #include "G4HadronElasticPhysics.hh" #include "G4NeutronTrackingCut.hh" #include "G4HadronicProcessStore.hh" +#include "G4EmStandardPhysics_option1.hh" #include "G4HadronPhysicsQGSP_FTFP_BERT.hh" @@ -35,7 +35,7 @@ QGSPCMS_FTFP_BERT_EML::QGSPCMS_FTFP_BERT_EML(const edm::ParameterSet& p) : Physi if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysics(ver)); + RegisterPhysics(new G4EmStandardPhysics_option1(ver)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMM.cc b/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMM.cc index 2854b0316f808..dcc8dd5270ba5 100644 --- a/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMM.cc @@ -1,5 +1,5 @@ #include "QGSPCMS_FTFP_BERT_EMM.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" #include "SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -35,7 +35,7 @@ QGSPCMS_FTFP_BERT_EMM::QGSPCMS_FTFP_BERT_EMM(const edm::ParameterSet& p) : Physi if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMN.cc b/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMN.cc index 5e85e4ad9d402..832609b7c7ca5 100644 --- a/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMN.cc +++ b/SimG4Core/PhysicsLists/plugins/QGSPCMS_FTFP_BERT_EMN.cc @@ -35,7 +35,7 @@ QGSPCMS_FTFP_BERT_EMN::QGSPCMS_FTFP_BERT_EMN(const edm::ParameterSet& p) : Physi if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsXS(ver)); + RegisterPhysics(new CMSEmStandardPhysicsXS(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); diff --git a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc index ce33df2109e7e..7f68c96f3a63a 100644 --- a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc +++ b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc @@ -1,82 +1,49 @@ #include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" -#include "SimG4Core/PhysicsLists/interface/EmParticleList.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "G4EmParameters.hh" -#include "G4ParticleTable.hh" - +#include "G4SystemOfUnits.hh" #include "G4ParticleDefinition.hh" -#include "G4LossTableManager.hh" +#include "G4EmParameters.hh" +#include "G4EmBuilder.hh" #include "G4ComptonScattering.hh" #include "G4GammaConversion.hh" #include "G4PhotoElectricEffect.hh" +#include "G4LivermorePhotoElectricModel.hh" + +#include "G4MscStepLimitType.hh" -#include "G4hMultipleScattering.hh" #include "G4eMultipleScattering.hh" -#include "G4MuMultipleScattering.hh" -#include "G4CoulombScattering.hh" +#include "G4hMultipleScattering.hh" #include "G4eCoulombScatteringModel.hh" +#include "G4CoulombScattering.hh" #include "G4WentzelVIModel.hh" #include "G4UrbanMscModel.hh" #include "G4eIonisation.hh" #include "G4eBremsstrahlung.hh" #include "G4eplusAnnihilation.hh" -#include "G4UAtomicDeexcitation.hh" - -#include "G4MuIonisation.hh" -#include "G4MuBremsstrahlung.hh" -#include "G4MuPairProduction.hh" #include "G4hIonisation.hh" #include "G4ionIonisation.hh" -#include "G4hBremsstrahlung.hh" -#include "G4hPairProduction.hh" +#include "G4ParticleTable.hh" #include "G4Gamma.hh" #include "G4Electron.hh" #include "G4Positron.hh" -#include "G4MuonPlus.hh" -#include "G4MuonMinus.hh" -#include "G4TauMinus.hh" -#include "G4TauPlus.hh" -#include "G4PionPlus.hh" -#include "G4PionMinus.hh" -#include "G4KaonPlus.hh" -#include "G4KaonMinus.hh" -#include "G4BMesonMinus.hh" -#include "G4BMesonPlus.hh" -#include "G4DMesonMinus.hh" -#include "G4DMesonPlus.hh" -#include "G4Proton.hh" -#include "G4AntiProton.hh" -#include "G4SigmaMinus.hh" -#include "G4AntiSigmaMinus.hh" -#include "G4SigmaPlus.hh" -#include "G4AntiSigmaPlus.hh" -#include "G4XiMinus.hh" -#include "G4AntiXiMinus.hh" -#include "G4OmegaMinus.hh" -#include "G4AntiOmegaMinus.hh" -#include "G4LambdacPlus.hh" -#include "G4AntiLambdacPlus.hh" -#include "G4XicPlus.hh" -#include "G4AntiXicPlus.hh" -#include "G4Deuteron.hh" -#include "G4Triton.hh" -#include "G4He3.hh" -#include "G4Alpha.hh" #include "G4GenericIon.hh" #include "G4PhysicsListHelper.hh" #include "G4BuilderType.hh" #include "G4GammaGeneralProcess.hh" +#include "G4LossTableManager.hh" -#include "G4SystemOfUnits.hh" +#include "G4RegionStore.hh" +#include "G4Region.hh" +#include -CMSEmStandardPhysics::CMSEmStandardPhysics(G4int ver) : G4VPhysicsConstructor("CMSEmStandard_eml"), verbose(ver) { +CMSEmStandardPhysics::CMSEmStandardPhysics(G4int ver, const edm::ParameterSet& p) + : G4VPhysicsConstructor("CMSEmStandard_emm"), verbose(ver) { G4EmParameters* param = G4EmParameters::Instance(); param->SetDefaults(); param->SetVerbose(verbose); @@ -85,234 +52,161 @@ CMSEmStandardPhysics::CMSEmStandardPhysics(G4int ver) : G4VPhysicsConstructor("C param->SetMscRangeFactor(0.2); param->SetMscStepLimitType(fMinimal); SetPhysicsType(bElectromagnetic); + fRangeFactor = p.getParameter("G4MscRangeFactor"); + fGeomFactor = p.getParameter("G4MscGeomFactor"); + fSafetyFactor = p.getParameter("G4MscSafetyFactor"); + fLambdaLimit = p.getParameter("G4MscLambdaLimit") * CLHEP::mm; + std::string msc = p.getParameter("G4MscStepLimit"); + fStepLimitType = fUseSafety; + if (msc == "UseSafetyPlus") { + fStepLimitType = fUseSafetyPlus; + } + if (msc == "Minimal") { + fStepLimitType = fMinimal; + } } CMSEmStandardPhysics::~CMSEmStandardPhysics() {} void CMSEmStandardPhysics::ConstructParticle() { - // gamma - G4Gamma::Gamma(); - - // leptons - G4Electron::Electron(); - G4Positron::Positron(); - G4MuonPlus::MuonPlus(); - G4MuonMinus::MuonMinus(); - G4TauMinus::TauMinusDefinition(); - G4TauPlus::TauPlusDefinition(); - - // mesons - G4PionPlus::PionPlusDefinition(); - G4PionMinus::PionMinusDefinition(); - G4KaonPlus::KaonPlusDefinition(); - G4KaonMinus::KaonMinusDefinition(); - G4DMesonMinus::DMesonMinusDefinition(); - G4DMesonPlus::DMesonPlusDefinition(); - G4BMesonMinus::BMesonMinusDefinition(); - G4BMesonPlus::BMesonPlusDefinition(); - - // barions - G4Proton::Proton(); - G4AntiProton::AntiProton(); - G4SigmaMinus::SigmaMinusDefinition(); - G4AntiSigmaMinus::AntiSigmaMinusDefinition(); - G4SigmaPlus::SigmaPlusDefinition(); - G4AntiSigmaPlus::AntiSigmaPlusDefinition(); - G4XiMinus::XiMinusDefinition(); - G4AntiXiMinus::AntiXiMinusDefinition(); - G4OmegaMinus::OmegaMinusDefinition(); - G4AntiOmegaMinus::AntiOmegaMinusDefinition(); - G4LambdacPlus::LambdacPlusDefinition(); - G4AntiLambdacPlus::AntiLambdacPlusDefinition(); - G4XicPlus::XicPlusDefinition(); - G4AntiXicPlus::AntiXicPlusDefinition(); - - // ions - G4Deuteron::Deuteron(); - G4Triton::Triton(); - G4He3::He3(); - G4Alpha::Alpha(); - G4GenericIon::GenericIonDefinition(); + // minimal set of particles for EM physics + G4EmBuilder::ConstructMinimalEmSet(); } void CMSEmStandardPhysics::ConstructProcess() { if (verbose > 0) { - edm::LogVerbatim("PhysicsList") << "### " << GetPhysicsName() << " Construct Processes "; + edm::LogVerbatim("PhysicsList") << "### " << GetPhysicsName() << " Construct EM Processes"; } // This EM builder takes default models of Geant4 10 EMV. - // Multiple scattering by Urban for all particles - // except e+e- below 100 MeV for which the Urban93 model is used + // Multiple scattering by WentzelVI for all particles except: + // a) e+e- below 100 MeV for which the Urban model is used + // b) ions for which Urban model is used + G4EmBuilder::PrepareEMPhysics(); G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); - G4LossTableManager* man = G4LossTableManager::Instance(); - - // muon & hadron bremsstrahlung and pair production - G4MuBremsstrahlung* mub = nullptr; - G4MuPairProduction* mup = nullptr; - G4hBremsstrahlung* pib = nullptr; - G4hPairProduction* pip = nullptr; - G4hBremsstrahlung* kb = nullptr; - G4hPairProduction* kp = nullptr; - G4hBremsstrahlung* pb = nullptr; - G4hPairProduction* pp = nullptr; - - // muon & hadron multiple scattering - G4MuMultipleScattering* mumsc = nullptr; - G4hMultipleScattering* pimsc = nullptr; - G4hMultipleScattering* kmsc = nullptr; - G4hMultipleScattering* hmsc = nullptr; - - // muon and hadron single scattering - G4CoulombScattering* muss = nullptr; - G4CoulombScattering* piss = nullptr; - G4CoulombScattering* kss = nullptr; - - // high energy limit for e+- scattering models and bremsstrahlung - G4double highEnergyLimit = 100 * MeV; - - G4ParticleTable* table = G4ParticleTable::GetParticleTable(); - EmParticleList emList; - for (const auto& particleName : emList.PartNames()) { - G4ParticleDefinition* particle = table->FindParticle(particleName); - - if (particleName == "gamma") { - G4PhotoElectricEffect* pee = new G4PhotoElectricEffect(); - - if (G4EmParameters::Instance()->GeneralProcessActive()) { - G4GammaGeneralProcess* sp = new G4GammaGeneralProcess(); - sp->AddEmProcess(pee); - sp->AddEmProcess(new G4ComptonScattering()); - sp->AddEmProcess(new G4GammaConversion()); - man->SetGammaGeneralProcess(sp); - ph->RegisterProcess(sp, particle); - } else { - ph->RegisterProcess(pee, particle); - ph->RegisterProcess(new G4ComptonScattering(), particle); - ph->RegisterProcess(new G4GammaConversion(), particle); - } - - } else if (particleName == "e-") { - G4eIonisation* eioni = new G4eIonisation(); - - G4eMultipleScattering* msc = new G4eMultipleScattering; - G4UrbanMscModel* msc1 = new G4UrbanMscModel(); - G4WentzelVIModel* msc2 = new G4WentzelVIModel(); - msc1->SetHighEnergyLimit(highEnergyLimit); - msc2->SetLowEnergyLimit(highEnergyLimit); - msc->SetEmModel(msc1); - msc->SetEmModel(msc2); - - G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel(); - G4CoulombScattering* ss = new G4CoulombScattering(); - ss->SetEmModel(ssm); - ss->SetMinKinEnergy(highEnergyLimit); - ssm->SetLowEnergyLimit(highEnergyLimit); - ssm->SetActivationLowEnergyLimit(highEnergyLimit); - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(new G4eBremsstrahlung(), particle); - ph->RegisterProcess(ss, particle); - - } else if (particleName == "e+") { - G4eIonisation* eioni = new G4eIonisation(); - - G4eMultipleScattering* msc = new G4eMultipleScattering; - G4UrbanMscModel* msc1 = new G4UrbanMscModel(); - G4WentzelVIModel* msc2 = new G4WentzelVIModel(); - msc1->SetHighEnergyLimit(highEnergyLimit); - msc2->SetLowEnergyLimit(highEnergyLimit); - msc->SetEmModel(msc1); - msc->SetEmModel(msc2); - - G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel(); - G4CoulombScattering* ss = new G4CoulombScattering(); - ss->SetEmModel(ssm); - ss->SetMinKinEnergy(highEnergyLimit); - ssm->SetLowEnergyLimit(highEnergyLimit); - ssm->SetActivationLowEnergyLimit(highEnergyLimit); - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(new G4eBremsstrahlung(), particle); - ph->RegisterProcess(new G4eplusAnnihilation(), particle); - ph->RegisterProcess(ss, particle); - - } else if (particleName == "mu+" || particleName == "mu-") { - if (nullptr == mub) { - mub = new G4MuBremsstrahlung(); - mup = new G4MuPairProduction(); - mumsc = new G4MuMultipleScattering(); - mumsc->SetEmModel(new G4WentzelVIModel()); - muss = new G4CoulombScattering(); - } - ph->RegisterProcess(mumsc, particle); - ph->RegisterProcess(new G4MuIonisation(), particle); - ph->RegisterProcess(mub, particle); - ph->RegisterProcess(mup, particle); - ph->RegisterProcess(muss, particle); - - } else if (particleName == "alpha" || particleName == "He3") { - ph->RegisterProcess(new G4hMultipleScattering(), particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "GenericIon") { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "pi+" || particleName == "pi-") { - if (nullptr == pib) { - pib = new G4hBremsstrahlung(); - pip = new G4hPairProduction(); - pimsc = new G4hMultipleScattering(); - pimsc->SetEmModel(new G4WentzelVIModel()); - piss = new G4CoulombScattering(); - } - ph->RegisterProcess(pimsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pib, particle); - ph->RegisterProcess(pip, particle); - ph->RegisterProcess(piss, particle); - - } else if (particleName == "kaon+" || particleName == "kaon-") { - if (nullptr == kb) { - kb = new G4hBremsstrahlung(); - kp = new G4hPairProduction(); - kmsc = new G4hMultipleScattering(); - kmsc->SetEmModel(new G4WentzelVIModel()); - kss = new G4CoulombScattering(); - } - ph->RegisterProcess(kmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(kb, particle); - ph->RegisterProcess(kp, particle); - ph->RegisterProcess(kss, particle); - - } else if (particleName == "proton" || particleName == "anti_proton") { - if (nullptr == pb) { - pb = new G4hBremsstrahlung(); - pp = new G4hPairProduction(); - } - G4hMultipleScattering* pmsc = new G4hMultipleScattering(); - pmsc->SetEmModel(new G4WentzelVIModel()); - G4CoulombScattering* pss = new G4CoulombScattering(); - - ph->RegisterProcess(pmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pb, particle); - ph->RegisterProcess(pp, particle); - ph->RegisterProcess(pss, particle); - - } else if (particle->GetPDGCharge() != 0.0) { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - } + // processes used by several particles + G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc"); + G4NuclearStopping* pnuc(nullptr); + + // high energy limit for e+- scattering models + G4double highEnergyLimit = G4EmParameters::Instance()->MscEnergyLimit(); + + const G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion", false); + const G4Region* bRegion = G4RegionStore::GetInstance()->GetRegion("HGCalRegion", false); + + // Add gamma EM Processes + G4ParticleDefinition* particle = G4Gamma::Gamma(); + + G4PhotoElectricEffect* pee = new G4PhotoElectricEffect(); + pee->SetEmModel(new G4LivermorePhotoElectricModel()); + + if (G4EmParameters::Instance()->GeneralProcessActive()) { + G4GammaGeneralProcess* sp = new G4GammaGeneralProcess(); + sp->AddEmProcess(pee); + sp->AddEmProcess(new G4ComptonScattering()); + sp->AddEmProcess(new G4GammaConversion()); + G4LossTableManager::Instance()->SetGammaGeneralProcess(sp); + ph->RegisterProcess(sp, particle); + + } else { + ph->RegisterProcess(pee, particle); + ph->RegisterProcess(new G4ComptonScattering(), particle); + ph->RegisterProcess(new G4GammaConversion(), particle); + } + + // e- + particle = G4Electron::Electron(); + + G4eIonisation* eioni = new G4eIonisation(); + + G4eMultipleScattering* msc = new G4eMultipleScattering; + G4UrbanMscModel* msc1 = new G4UrbanMscModel(); + G4WentzelVIModel* msc2 = new G4WentzelVIModel(); + G4UrbanMscModel* msc3 = new G4UrbanMscModel(); + msc1->SetHighEnergyLimit(highEnergyLimit); + msc2->SetLowEnergyLimit(highEnergyLimit); + msc3->SetHighEnergyLimit(highEnergyLimit); + + // e-/e+ msc for HCAL and HGCAL using the Urban model + msc3->SetRangeFactor(fRangeFactor); + msc3->SetGeomFactor(fGeomFactor); + msc3->SetSafetyFactor(fSafetyFactor); + msc3->SetLambdaLimit(fLambdaLimit); + msc3->SetStepLimitType(fStepLimitType); + + msc3->SetLocked(true); + msc->SetEmModel(msc1); + msc->SetEmModel(msc2); + if (nullptr != aRegion) { + msc->AddEmModel(-1, msc3, aRegion); + } + if (nullptr != bRegion) { + msc->AddEmModel(-1, msc3, bRegion); + } + + // single scattering + G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel(); + G4CoulombScattering* ss = new G4CoulombScattering(); + ss->SetEmModel(ssm); + ss->SetMinKinEnergy(highEnergyLimit); + ssm->SetLowEnergyLimit(highEnergyLimit); + ssm->SetActivationLowEnergyLimit(highEnergyLimit); + + ph->RegisterProcess(msc, particle); + ph->RegisterProcess(eioni, particle); + ph->RegisterProcess(new G4eBremsstrahlung(), particle); + ph->RegisterProcess(ss, particle); + + // e+ + particle = G4Positron::Positron(); + eioni = new G4eIonisation(); + + msc = new G4eMultipleScattering(); + msc1 = new G4UrbanMscModel(); + msc2 = new G4WentzelVIModel(); + msc3 = new G4UrbanMscModel(); + msc1->SetHighEnergyLimit(highEnergyLimit); + msc2->SetLowEnergyLimit(highEnergyLimit); + msc3->SetHighEnergyLimit(highEnergyLimit); + + // e-/e+ msc for HCAL and HGCAL using the Urban model + msc3->SetRangeFactor(fRangeFactor); + msc3->SetGeomFactor(fGeomFactor); + msc3->SetSafetyFactor(fSafetyFactor); + msc3->SetLambdaLimit(fLambdaLimit); + msc3->SetStepLimitType(fStepLimitType); + + msc3->SetLocked(true); + msc->SetEmModel(msc1); + msc->SetEmModel(msc2); + if (nullptr != aRegion) { + msc->AddEmModel(-1, msc3, aRegion); + } + if (nullptr != bRegion) { + msc->AddEmModel(-1, msc3, bRegion); } + + // single scattering + ssm = new G4eCoulombScatteringModel(); + ss = new G4CoulombScattering(); + ss->SetEmModel(ssm); + ss->SetMinKinEnergy(highEnergyLimit); + ssm->SetLowEnergyLimit(highEnergyLimit); + ssm->SetActivationLowEnergyLimit(highEnergyLimit); + + ph->RegisterProcess(msc, particle); + ph->RegisterProcess(eioni, particle); + ph->RegisterProcess(new G4eBremsstrahlung(), particle); + ph->RegisterProcess(new G4eplusAnnihilation(), particle); + ph->RegisterProcess(ss, particle); + + // generic ion + particle = G4GenericIon::GenericIon(); + G4ionIonisation* ionIoni = new G4ionIonisation(); + ph->RegisterProcess(hmsc, particle); + ph->RegisterProcess(ionIoni, particle); + + // muons, hadrons ions + G4EmBuilder::ConstructCharged(hmsc, pnuc); } diff --git a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95.cc b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95.cc deleted file mode 100644 index e6b20ffe2719f..0000000000000 --- a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95.cc +++ /dev/null @@ -1,254 +0,0 @@ -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95.h" -#include "SimG4Core/PhysicsLists/interface/EmParticleList.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "G4EmParameters.hh" -#include "G4ParticleTable.hh" - -#include "G4ParticleDefinition.hh" -#include "G4ProcessManager.hh" -#include "G4LossTableManager.hh" -#include "G4RegionStore.hh" - -#include "G4ComptonScattering.hh" -#include "G4GammaConversion.hh" -#include "G4GammaConversion.hh" -#include "G4PairProductionRelModel.hh" -#include "G4PhotoElectricEffect.hh" - -#include "G4hMultipleScattering.hh" -#include "G4eMultipleScattering.hh" -#include "G4MscStepLimitType.hh" - -#include "G4eIonisation.hh" -#include "G4eBremsstrahlung.hh" -#include "G4eplusAnnihilation.hh" - -#include "G4MuMultipleScattering.hh" -#include "G4MuIonisation.hh" -#include "G4MuBremsstrahlung.hh" -#include "G4MuPairProduction.hh" - -#include "G4hIonisation.hh" -#include "G4ionIonisation.hh" -#include "G4hBremsstrahlung.hh" -#include "G4hPairProduction.hh" - -#include "G4Gamma.hh" -#include "G4Electron.hh" -#include "G4Positron.hh" -#include "G4MuonPlus.hh" -#include "G4MuonMinus.hh" -#include "G4TauMinus.hh" -#include "G4TauPlus.hh" -#include "G4PionPlus.hh" -#include "G4PionMinus.hh" -#include "G4KaonPlus.hh" -#include "G4KaonMinus.hh" -#include "G4BMesonMinus.hh" -#include "G4BMesonPlus.hh" -#include "G4DMesonMinus.hh" -#include "G4DMesonPlus.hh" -#include "G4Proton.hh" -#include "G4AntiProton.hh" -#include "G4SigmaMinus.hh" -#include "G4AntiSigmaMinus.hh" -#include "G4SigmaPlus.hh" -#include "G4AntiSigmaPlus.hh" -#include "G4XiMinus.hh" -#include "G4AntiXiMinus.hh" -#include "G4OmegaMinus.hh" -#include "G4AntiOmegaMinus.hh" -#include "G4LambdacPlus.hh" -#include "G4AntiLambdacPlus.hh" -#include "G4XicPlus.hh" -#include "G4AntiXicPlus.hh" -#include "G4Deuteron.hh" -#include "G4Triton.hh" -#include "G4He3.hh" -#include "G4Alpha.hh" -#include "G4GenericIon.hh" -#include "G4BuilderType.hh" - -#include "G4SystemOfUnits.hh" - -CMSEmStandardPhysics95::CMSEmStandardPhysics95(const G4String& name, G4int ver, const std::string& reg) - : G4VPhysicsConstructor(name), verbose(ver), region(reg) { - G4EmParameters* param = G4EmParameters::Instance(); - param->SetDefaults(); - param->SetVerbose(verbose); - param->SetApplyCuts(true); - param->SetStepFunction(0.8, 1 * CLHEP::mm); - param->SetMscRangeFactor(0.2); - param->SetMscStepLimitType(fMinimal); - SetPhysicsType(bElectromagnetic); -} - -CMSEmStandardPhysics95::~CMSEmStandardPhysics95() {} - -void CMSEmStandardPhysics95::ConstructParticle() { - // gamma - G4Gamma::Gamma(); - - // leptons - G4Electron::Electron(); - G4Positron::Positron(); - G4MuonPlus::MuonPlus(); - G4MuonMinus::MuonMinus(); - G4TauMinus::TauMinusDefinition(); - G4TauPlus::TauPlusDefinition(); - - // mesons - G4PionPlus::PionPlusDefinition(); - G4PionMinus::PionMinusDefinition(); - G4KaonPlus::KaonPlusDefinition(); - G4KaonMinus::KaonMinusDefinition(); - G4DMesonMinus::DMesonMinusDefinition(); - G4DMesonPlus::DMesonPlusDefinition(); - G4BMesonMinus::BMesonMinusDefinition(); - G4BMesonPlus::BMesonPlusDefinition(); - - // barions - G4Proton::Proton(); - G4AntiProton::AntiProton(); - G4SigmaMinus::SigmaMinusDefinition(); - G4AntiSigmaMinus::AntiSigmaMinusDefinition(); - G4SigmaPlus::SigmaPlusDefinition(); - G4AntiSigmaPlus::AntiSigmaPlusDefinition(); - G4XiMinus::XiMinusDefinition(); - G4AntiXiMinus::AntiXiMinusDefinition(); - G4OmegaMinus::OmegaMinusDefinition(); - G4AntiOmegaMinus::AntiOmegaMinusDefinition(); - G4LambdacPlus::LambdacPlusDefinition(); - G4AntiLambdacPlus::AntiLambdacPlusDefinition(); - G4XicPlus::XicPlusDefinition(); - G4AntiXicPlus::AntiXicPlusDefinition(); - - // ions - G4Deuteron::Deuteron(); - G4Triton::Triton(); - G4He3::He3(); - G4Alpha::Alpha(); - G4GenericIon::GenericIonDefinition(); -} - -void CMSEmStandardPhysics95::ConstructProcess() { - // This EM builder takes default models of Geant4 EMV. - // Multiple scattering by Urban for all particles - - G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); - - // muon & hadron bremsstrahlung and pair production - G4MuBremsstrahlung* mub = nullptr; - G4MuPairProduction* mup = nullptr; - G4hBremsstrahlung* pib = nullptr; - G4hPairProduction* pip = nullptr; - G4hBremsstrahlung* kb = nullptr; - G4hPairProduction* kp = nullptr; - G4hBremsstrahlung* pb = nullptr; - G4hPairProduction* pp = nullptr; - - // muon & hadron multiple scattering - G4MuMultipleScattering* mumsc = nullptr; - G4hMultipleScattering* pimsc = nullptr; - G4hMultipleScattering* kmsc = nullptr; - G4hMultipleScattering* pmsc = nullptr; - G4hMultipleScattering* hmsc = nullptr; - - // Add standard EM Processes - G4ParticleTable* table = G4ParticleTable::GetParticleTable(); - EmParticleList emList; - for (const auto& particleName : emList.PartNames()) { - G4ParticleDefinition* particle = table->FindParticle(particleName); - if (verbose > 1) - edm::LogVerbatim("PhysicsList") << "### " << GetPhysicsName() << " instantiates for " << particleName; - - if (particleName == "gamma") { - ph->RegisterProcess(new G4PhotoElectricEffect(), particle); - ph->RegisterProcess(new G4ComptonScattering(), particle); - ph->RegisterProcess(new G4GammaConversion(), particle); - - } else if (particleName == "e-") { - G4eIonisation* eioni = new G4eIonisation(); - G4eMultipleScattering* msc = new G4eMultipleScattering(); - G4eBremsstrahlung* ebrem = new G4eBremsstrahlung(); - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(ebrem, particle); - - } else if (particleName == "e+") { - G4eIonisation* eioni = new G4eIonisation(); - G4eMultipleScattering* msc = new G4eMultipleScattering(); - G4eBremsstrahlung* ebrem = new G4eBremsstrahlung(); - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(ebrem, particle); - ph->RegisterProcess(new G4eplusAnnihilation(), particle); - - } else if (particleName == "mu+" || particleName == "mu-") { - if (nullptr == mub) { - mub = new G4MuBremsstrahlung(); - mup = new G4MuPairProduction(); - mumsc = new G4MuMultipleScattering(); - } - ph->RegisterProcess(mumsc, particle); - ph->RegisterProcess(new G4MuIonisation(), particle); - ph->RegisterProcess(mub, particle); - ph->RegisterProcess(mup, particle); - - } else if (particleName == "alpha" || particleName == "He3") { - ph->RegisterProcess(new G4hMultipleScattering(), particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "GenericIon") { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "pi+" || particleName == "pi-") { - if (nullptr == pib) { - pib = new G4hBremsstrahlung(); - pip = new G4hPairProduction(); - pimsc = new G4hMultipleScattering(); - } - ph->RegisterProcess(pimsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pib, particle); - ph->RegisterProcess(pip, particle); - - } else if (particleName == "kaon+" || particleName == "kaon-") { - if (nullptr == kb) { - kb = new G4hBremsstrahlung(); - kp = new G4hPairProduction(); - kmsc = new G4hMultipleScattering(); - } - ph->RegisterProcess(kmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(kb, particle); - ph->RegisterProcess(kp, particle); - - } else if (particleName == "proton" || particleName == "anti_proton") { - if (nullptr == pb) { - pb = new G4hBremsstrahlung(); - pp = new G4hPairProduction(); - } - pmsc = new G4hMultipleScattering(); - ph->RegisterProcess(pmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pb, particle); - ph->RegisterProcess(pp, particle); - - } else if (particle->GetPDGCharge() != 0.0) { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - } - } -} diff --git a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95msc93.cc b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95msc93.cc deleted file mode 100644 index 05001ab333e3e..0000000000000 --- a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95msc93.cc +++ /dev/null @@ -1,261 +0,0 @@ -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics95msc93.h" -#include "SimG4Core/PhysicsLists/interface/UrbanMscModel93.h" -#include "SimG4Core/PhysicsLists/interface/EmParticleList.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "G4EmParameters.hh" -#include "G4ParticleTable.hh" - -#include "G4ParticleDefinition.hh" -#include "G4ProcessManager.hh" -#include "G4LossTableManager.hh" -#include "G4RegionStore.hh" - -#include "G4ComptonScattering.hh" -#include "G4GammaConversion.hh" -#include "G4PhotoElectricEffect.hh" -#include "G4PairProductionRelModel.hh" - -#include "G4hMultipleScattering.hh" -#include "G4eMultipleScattering.hh" -#include "G4MuMultipleScattering.hh" -#include "G4MscStepLimitType.hh" - -#include "G4eIonisation.hh" -#include "G4eBremsstrahlung.hh" -#include "G4eplusAnnihilation.hh" - -#include "G4MuIonisation.hh" -#include "G4MuBremsstrahlung.hh" -#include "G4MuPairProduction.hh" - -#include "G4hIonisation.hh" -#include "G4ionIonisation.hh" -#include "G4hBremsstrahlung.hh" -#include "G4hPairProduction.hh" - -#include "G4Gamma.hh" -#include "G4Electron.hh" -#include "G4Positron.hh" -#include "G4MuonPlus.hh" -#include "G4MuonMinus.hh" -#include "G4TauMinus.hh" -#include "G4TauPlus.hh" -#include "G4PionPlus.hh" -#include "G4PionMinus.hh" -#include "G4KaonPlus.hh" -#include "G4KaonMinus.hh" -#include "G4BMesonMinus.hh" -#include "G4BMesonPlus.hh" -#include "G4DMesonMinus.hh" -#include "G4DMesonPlus.hh" -#include "G4Proton.hh" -#include "G4AntiProton.hh" -#include "G4SigmaMinus.hh" -#include "G4AntiSigmaMinus.hh" -#include "G4SigmaPlus.hh" -#include "G4AntiSigmaPlus.hh" -#include "G4XiMinus.hh" -#include "G4AntiXiMinus.hh" -#include "G4OmegaMinus.hh" -#include "G4AntiOmegaMinus.hh" -#include "G4LambdacPlus.hh" -#include "G4AntiLambdacPlus.hh" -#include "G4XicPlus.hh" -#include "G4AntiXicPlus.hh" -#include "G4Deuteron.hh" -#include "G4Triton.hh" -#include "G4He3.hh" -#include "G4Alpha.hh" -#include "G4GenericIon.hh" - -#include "G4BuilderType.hh" -#include "G4SystemOfUnits.hh" - -CMSEmStandardPhysics95msc93::CMSEmStandardPhysics95msc93(const G4String& name, G4int ver, const std::string& reg) - : G4VPhysicsConstructor(name), verbose(ver), region(reg) { - G4EmParameters* param = G4EmParameters::Instance(); - param->SetDefaults(); - param->SetVerbose(verbose); - param->SetApplyCuts(true); - param->SetStepFunction(0.8, 1 * CLHEP::mm); - param->SetMscRangeFactor(0.2); - param->SetMscStepLimitType(fMinimal); - SetPhysicsType(bElectromagnetic); -} - -CMSEmStandardPhysics95msc93::~CMSEmStandardPhysics95msc93() {} - -void CMSEmStandardPhysics95msc93::ConstructParticle() { - // gamma - G4Gamma::Gamma(); - - // leptons - G4Electron::Electron(); - G4Positron::Positron(); - G4MuonPlus::MuonPlus(); - G4MuonMinus::MuonMinus(); - G4TauMinus::TauMinusDefinition(); - G4TauPlus::TauPlusDefinition(); - - // mesons - G4PionPlus::PionPlusDefinition(); - G4PionMinus::PionMinusDefinition(); - G4KaonPlus::KaonPlusDefinition(); - G4KaonMinus::KaonMinusDefinition(); - G4DMesonMinus::DMesonMinusDefinition(); - G4DMesonPlus::DMesonPlusDefinition(); - G4BMesonMinus::BMesonMinusDefinition(); - G4BMesonPlus::BMesonPlusDefinition(); - - // barions - G4Proton::Proton(); - G4AntiProton::AntiProton(); - G4SigmaMinus::SigmaMinusDefinition(); - G4AntiSigmaMinus::AntiSigmaMinusDefinition(); - G4SigmaPlus::SigmaPlusDefinition(); - G4AntiSigmaPlus::AntiSigmaPlusDefinition(); - G4XiMinus::XiMinusDefinition(); - G4AntiXiMinus::AntiXiMinusDefinition(); - G4OmegaMinus::OmegaMinusDefinition(); - G4AntiOmegaMinus::AntiOmegaMinusDefinition(); - G4LambdacPlus::LambdacPlusDefinition(); - G4AntiLambdacPlus::AntiLambdacPlusDefinition(); - G4XicPlus::XicPlusDefinition(); - G4AntiXicPlus::AntiXicPlusDefinition(); - - // ions - G4Deuteron::Deuteron(); - G4Triton::Triton(); - G4He3::He3(); - G4Alpha::Alpha(); - G4GenericIon::GenericIonDefinition(); -} - -void CMSEmStandardPhysics95msc93::ConstructProcess() { - // Add standard EM Processes - G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); - - // muon & hadron bremsstrahlung and pair production - G4MuBremsstrahlung* mub = nullptr; - G4MuPairProduction* mup = nullptr; - G4hBremsstrahlung* pib = nullptr; - G4hPairProduction* pip = nullptr; - G4hBremsstrahlung* kb = nullptr; - G4hPairProduction* kp = nullptr; - G4hBremsstrahlung* pb = nullptr; - G4hPairProduction* pp = nullptr; - - // muon & hadron multiple scattering - G4MuMultipleScattering* mumsc = nullptr; - G4hMultipleScattering* pimsc = nullptr; - G4hMultipleScattering* kmsc = nullptr; - G4hMultipleScattering* pmsc = nullptr; - G4hMultipleScattering* hmsc = nullptr; - - // This EM builder takes default models of Geant4 10 EMV. - // Multiple scattering by Urban for all particles - // except e+e- for which the Urban93 model is used - - G4ParticleTable* table = G4ParticleTable::GetParticleTable(); - EmParticleList emList; - for (const auto& particleName : emList.PartNames()) { - G4ParticleDefinition* particle = table->FindParticle(particleName); - if (verbose > 1) - edm::LogVerbatim("PhysicsList") << "### " << GetPhysicsName() << " instantiates for " << particleName; - - if (particleName == "gamma") { - ph->RegisterProcess(new G4PhotoElectricEffect(), particle); - ph->RegisterProcess(new G4ComptonScattering(), particle); - ph->RegisterProcess(new G4GammaConversion(), particle); - - } else if (particleName == "e-") { - G4eIonisation* eioni = new G4eIonisation(); - G4eMultipleScattering* msc = new G4eMultipleScattering; - msc->SetEmModel(new UrbanMscModel93()); - - G4eBremsstrahlung* ebrem = new G4eBremsstrahlung(); - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(ebrem, particle); - - } else if (particleName == "e+") { - G4eIonisation* eioni = new G4eIonisation(); - - G4eMultipleScattering* msc = new G4eMultipleScattering; - msc->SetEmModel(new UrbanMscModel93()); - - G4eBremsstrahlung* ebrem = new G4eBremsstrahlung(); - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(ebrem, particle); - ph->RegisterProcess(new G4eplusAnnihilation(), particle); - - } else if (particleName == "mu+" || particleName == "mu-") { - if (nullptr == mub) { - mub = new G4MuBremsstrahlung(); - mup = new G4MuPairProduction(); - mumsc = new G4MuMultipleScattering(); - } - ph->RegisterProcess(mumsc, particle); - ph->RegisterProcess(new G4MuIonisation(), particle); - ph->RegisterProcess(mub, particle); - ph->RegisterProcess(mup, particle); - - } else if (particleName == "alpha" || particleName == "He3") { - ph->RegisterProcess(new G4hMultipleScattering(), particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "GenericIon") { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "pi+" || particleName == "pi-") { - if (nullptr == pib) { - pib = new G4hBremsstrahlung(); - pip = new G4hPairProduction(); - pimsc = new G4hMultipleScattering(); - } - ph->RegisterProcess(pimsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pib, particle); - ph->RegisterProcess(pip, particle); - - } else if (particleName == "kaon+" || particleName == "kaon-") { - if (nullptr == kb) { - kb = new G4hBremsstrahlung(); - kp = new G4hPairProduction(); - kmsc = new G4hMultipleScattering(); - } - ph->RegisterProcess(kmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(kb, particle); - ph->RegisterProcess(kp, particle); - - } else if (particleName == "proton" || particleName == "anti_proton") { - if (nullptr == pb) { - pb = new G4hBremsstrahlung(); - pp = new G4hPairProduction(); - } - pmsc = new G4hMultipleScattering(); - - ph->RegisterProcess(pmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pb, particle); - ph->RegisterProcess(pp, particle); - - } else if (particle->GetPDGCharge() != 0.0) { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - } - } -} diff --git a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysicsXS.cc b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysicsXS.cc index 2dc2f5bc021ee..673cde5d83169 100644 --- a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysicsXS.cc +++ b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysicsXS.cc @@ -1,156 +1,92 @@ #include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsXS.h" -#include "SimG4Core/PhysicsLists/interface/EmParticleList.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "G4EmParameters.hh" -#include "G4ParticleTable.hh" - +#include "G4SystemOfUnits.hh" #include "G4ParticleDefinition.hh" #include "G4LossTableManager.hh" #include "G4EmParameters.hh" +#include "G4EmBuilder.hh" #include "G4ComptonScattering.hh" #include "G4GammaConversion.hh" #include "G4PhotoElectricEffect.hh" -#include "G4LivermorePhotoElectricModel.hh" +#include "G4RayleighScattering.hh" +#include "G4PEEffectFluoModel.hh" #include "G4KleinNishinaModel.hh" +#include "G4LowEPComptonModel.hh" +#include "G4BetheHeitler5DModel.hh" +#include "G4LivermorePhotoElectricModel.hh" -#include "G4hMultipleScattering.hh" #include "G4eMultipleScattering.hh" -#include "G4MuMultipleScattering.hh" -#include "G4CoulombScattering.hh" -#include "G4eCoulombScatteringModel.hh" -#include "G4WentzelVIModel.hh" +#include "G4hMultipleScattering.hh" +#include "G4MscStepLimitType.hh" #include "G4UrbanMscModel.hh" #include "G4GoudsmitSaundersonMscModel.hh" -#include "G4MscStepLimitType.hh" +#include "G4DummyModel.hh" +#include "G4WentzelVIModel.hh" +#include "G4CoulombScattering.hh" +#include "G4eCoulombScatteringModel.hh" #include "G4eIonisation.hh" #include "G4eBremsstrahlung.hh" -#include "G4eplusAnnihilation.hh" #include "G4Generator2BS.hh" #include "G4SeltzerBergerModel.hh" - -#include "G4MuIonisation.hh" -#include "G4MuBremsstrahlung.hh" -#include "G4MuPairProduction.hh" - -#include "G4MuBremsstrahlungModel.hh" -#include "G4MuPairProductionModel.hh" -#include "G4hBremsstrahlungModel.hh" -#include "G4hPairProductionModel.hh" #include "G4ePairProduction.hh" +#include "G4UniversalFluctuation.hh" + +#include "G4eplusAnnihilation.hh" #include "G4hIonisation.hh" #include "G4ionIonisation.hh" -#include "G4hBremsstrahlung.hh" -#include "G4hPairProduction.hh" -#include "G4UAtomicDeexcitation.hh" #include "G4Gamma.hh" #include "G4Electron.hh" #include "G4Positron.hh" -#include "G4MuonPlus.hh" -#include "G4MuonMinus.hh" -#include "G4TauMinus.hh" -#include "G4TauPlus.hh" -#include "G4PionPlus.hh" -#include "G4PionMinus.hh" -#include "G4KaonPlus.hh" -#include "G4KaonMinus.hh" -#include "G4BMesonMinus.hh" -#include "G4BMesonPlus.hh" -#include "G4DMesonMinus.hh" -#include "G4DMesonPlus.hh" -#include "G4Proton.hh" -#include "G4AntiProton.hh" -#include "G4SigmaMinus.hh" -#include "G4AntiSigmaMinus.hh" -#include "G4SigmaPlus.hh" -#include "G4AntiSigmaPlus.hh" -#include "G4XiMinus.hh" -#include "G4AntiXiMinus.hh" -#include "G4OmegaMinus.hh" -#include "G4AntiOmegaMinus.hh" -#include "G4LambdacPlus.hh" -#include "G4AntiLambdacPlus.hh" -#include "G4XicPlus.hh" -#include "G4AntiXicPlus.hh" -#include "G4Deuteron.hh" -#include "G4Triton.hh" -#include "G4He3.hh" -#include "G4Alpha.hh" #include "G4GenericIon.hh" #include "G4PhysicsListHelper.hh" #include "G4BuilderType.hh" +#include "G4GammaGeneralProcess.hh" + #include "G4RegionStore.hh" #include "G4Region.hh" #include "G4GammaGeneralProcess.hh" #include "G4SystemOfUnits.hh" -CMSEmStandardPhysicsXS::CMSEmStandardPhysicsXS(G4int ver) : G4VPhysicsConstructor("CMSEmStandard_emn"), verbose(ver) { +CMSEmStandardPhysicsXS::CMSEmStandardPhysicsXS(G4int ver, const edm::ParameterSet& p) + : G4VPhysicsConstructor("CMSEmStandard_emn"), verbose(ver) { G4EmParameters* param = G4EmParameters::Instance(); param->SetDefaults(); param->SetVerbose(verbose); param->SetApplyCuts(true); - param->SetLowestElectronEnergy(100 * eV); + param->SetMinEnergy(100 * CLHEP::eV); + param->SetNumberOfBinsPerDecade(20); param->SetStepFunction(0.8, 1 * CLHEP::mm); - param->SetUseMottCorrection(true); // use Mott-correction for e-/e+ msc gs param->SetMscRangeFactor(0.2); param->SetMscStepLimitType(fMinimal); param->SetFluo(true); + param->SetUseMottCorrection(true); // use Mott-correction for e-/e+ msc gs SetPhysicsType(bElectromagnetic); + fRangeFactor = p.getParameter("G4MscRangeFactor"); + fGeomFactor = p.getParameter("G4MscGeomFactor"); + fSafetyFactor = p.getParameter("G4MscSafetyFactor"); + fLambdaLimit = p.getParameter("G4MscLambdaLimit") * CLHEP::mm; + std::string msc = p.getParameter("G4MscStepLimit"); + fStepLimitType = fUseSafety; + if (msc == "UseSafetyPlus") { + fStepLimitType = fUseSafetyPlus; + } + if (msc == "Minimal") { + fStepLimitType = fMinimal; + } } CMSEmStandardPhysicsXS::~CMSEmStandardPhysicsXS() {} void CMSEmStandardPhysicsXS::ConstructParticle() { - // gamma - G4Gamma::Gamma(); - - // leptons - G4Electron::Electron(); - G4Positron::Positron(); - G4MuonPlus::MuonPlus(); - G4MuonMinus::MuonMinus(); - G4TauMinus::TauMinusDefinition(); - G4TauPlus::TauPlusDefinition(); - - // mesons - G4PionPlus::PionPlusDefinition(); - G4PionMinus::PionMinusDefinition(); - G4KaonPlus::KaonPlusDefinition(); - G4KaonMinus::KaonMinusDefinition(); - G4DMesonMinus::DMesonMinusDefinition(); - G4DMesonPlus::DMesonPlusDefinition(); - G4BMesonMinus::BMesonMinusDefinition(); - G4BMesonPlus::BMesonPlusDefinition(); - - // barions - G4Proton::Proton(); - G4AntiProton::AntiProton(); - G4SigmaMinus::SigmaMinusDefinition(); - G4AntiSigmaMinus::AntiSigmaMinusDefinition(); - G4SigmaPlus::SigmaPlusDefinition(); - G4AntiSigmaPlus::AntiSigmaPlusDefinition(); - G4XiMinus::XiMinusDefinition(); - G4AntiXiMinus::AntiXiMinusDefinition(); - G4OmegaMinus::OmegaMinusDefinition(); - G4AntiOmegaMinus::AntiOmegaMinusDefinition(); - G4LambdacPlus::LambdacPlusDefinition(); - G4AntiLambdacPlus::AntiLambdacPlusDefinition(); - G4XicPlus::XicPlusDefinition(); - G4AntiXicPlus::AntiXicPlusDefinition(); - - // ions - G4Deuteron::Deuteron(); - G4Triton::Triton(); - G4He3::He3(); - G4Alpha::Alpha(); - G4GenericIon::GenericIonDefinition(); + // minimal set of particles for EM physics + G4EmBuilder::ConstructMinimalEmSet(); } void CMSEmStandardPhysicsXS::ConstructProcess() { @@ -161,243 +97,191 @@ void CMSEmStandardPhysicsXS::ConstructProcess() { // This EM builder takes default models of Geant4 10 EMV. // Multiple scattering by Urban for all particles // except e+e- below 100 MeV for which the Urban model is used + G4EmBuilder::PrepareEMPhysics(); G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); - G4LossTableManager* man = G4LossTableManager::Instance(); - - // muon & hadron bremsstrahlung and pair production - G4MuBremsstrahlung* mub = nullptr; - G4MuPairProduction* mup = nullptr; - G4hBremsstrahlung* pib = nullptr; - G4hPairProduction* pip = nullptr; - G4hBremsstrahlung* kb = nullptr; - G4hPairProduction* kp = nullptr; - G4hBremsstrahlung* pb = nullptr; - G4hPairProduction* pp = nullptr; - G4ePairProduction* ee = nullptr; - - // muon & hadron multiple scattering - G4MuMultipleScattering* mumsc = nullptr; - G4hMultipleScattering* pimsc = nullptr; - G4hMultipleScattering* kmsc = nullptr; - G4hMultipleScattering* hmsc = nullptr; - - // muon and hadron single scattering - G4CoulombScattering* muss = nullptr; - G4CoulombScattering* piss = nullptr; - G4CoulombScattering* kss = nullptr; - - // high energy limit for e+- scattering models and bremsstrahlung - G4double highEnergyLimit = 100 * MeV; - - G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion", false); - G4Region* bRegion = G4RegionStore::GetInstance()->GetRegion("HGCalRegion", false); - if (verbose > 1) { - edm::LogVerbatim("PhysicsList") << "CMSEmStandardPhysicsLPM: HcalRegion " << aRegion << "; HGCalRegion " << bRegion; + + // processes used by several particles + G4ePairProduction* ee = new G4ePairProduction(); + G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc"); + G4NuclearStopping* pnuc(nullptr); + + // high energy limit for e+- scattering models + G4double highEnergyLimit = G4EmParameters::Instance()->MscEnergyLimit(); + const G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion", false); + const G4Region* bRegion = G4RegionStore::GetInstance()->GetRegion("HGCalRegion", false); + + // Add gamma EM Processes + G4ParticleDefinition* particle = G4Gamma::Gamma(); + + // Photoelectric + G4PhotoElectricEffect* pe = new G4PhotoElectricEffect(); + G4VEmModel* theLivermorePEModel = new G4LivermorePhotoElectricModel(); + pe->SetEmModel(theLivermorePEModel); + + // Compton scattering + G4ComptonScattering* cs = new G4ComptonScattering; + cs->SetEmModel(new G4KleinNishinaModel()); + + // Gamma conversion + G4GammaConversion* gc = new G4GammaConversion(); + G4VEmModel* conv = new G4BetheHeitler5DModel(); + gc->SetEmModel(conv); + + if (G4EmParameters::Instance()->GeneralProcessActive()) { + G4GammaGeneralProcess* sp = new G4GammaGeneralProcess(); + sp->AddEmProcess(pe); + sp->AddEmProcess(cs); + sp->AddEmProcess(gc); + sp->AddEmProcess(new G4RayleighScattering()); + G4LossTableManager::Instance()->SetGammaGeneralProcess(sp); + ph->RegisterProcess(sp, particle); + } else { + ph->RegisterProcess(pe, particle); + ph->RegisterProcess(cs, particle); + ph->RegisterProcess(gc, particle); + ph->RegisterProcess(new G4RayleighScattering(), particle); + } + + // e- + particle = G4Electron::Electron(); + + // multiple scattering + G4eMultipleScattering* msc = new G4eMultipleScattering(); + G4UrbanMscModel* msc1 = new G4UrbanMscModel(); + G4WentzelVIModel* msc2 = new G4WentzelVIModel(); + G4UrbanMscModel* msc4 = new G4UrbanMscModel(); + G4GoudsmitSaundersonMscModel* msc3 = new G4GoudsmitSaundersonMscModel(); + msc1->SetHighEnergyLimit(highEnergyLimit); + msc2->SetLowEnergyLimit(highEnergyLimit); + msc3->SetHighEnergyLimit(highEnergyLimit); + msc4->SetHighEnergyLimit(highEnergyLimit); + + // e-/e+ msc GS with Mott-correction + // (Mott-correction is set through G4EmParameters) + msc3->SetRangeFactor(0.08); + msc3->SetSkin(3.); + msc3->SetStepLimitType(fUseSafetyPlus); + + // e-/e+ msc for HCAL using the Urban model + msc4->SetRangeFactor(fRangeFactor); + msc4->SetGeomFactor(fGeomFactor); + msc4->SetSafetyFactor(fSafetyFactor); + msc4->SetLambdaLimit(fLambdaLimit); + msc4->SetStepLimitType(fStepLimitType); + + msc3->SetLocked(true); + msc4->SetLocked(true); + msc->SetEmModel(msc1); + msc->SetEmModel(msc2); + if (nullptr != aRegion) { + msc->AddEmModel(-1, msc4, aRegion); + } + if (nullptr != bRegion) { + msc->AddEmModel(-1, msc3, bRegion); } - G4ParticleTable* table = G4ParticleTable::GetParticleTable(); - EmParticleList emList; - for (const auto& particleName : emList.PartNames()) { - G4ParticleDefinition* particle = table->FindParticle(particleName); - - if (particleName == "gamma") { - G4PhotoElectricEffect* photo = new G4PhotoElectricEffect(); - photo->SetEmModel(new G4LivermorePhotoElectricModel()); - - G4ComptonScattering* compt = new G4ComptonScattering(); - compt->SetEmModel(new G4KleinNishinaModel()); - - if (G4EmParameters::Instance()->GeneralProcessActive()) { - G4GammaGeneralProcess* sp = new G4GammaGeneralProcess(); - sp->AddEmProcess(photo); - sp->AddEmProcess(compt); - sp->AddEmProcess(new G4GammaConversion()); - man->SetGammaGeneralProcess(sp); - ph->RegisterProcess(sp, particle); - - } else { - ph->RegisterProcess(photo, particle); - ph->RegisterProcess(compt, particle); - ph->RegisterProcess(new G4GammaConversion(), particle); - } - - } else if (particleName == "e-") { - G4eIonisation* eioni = new G4eIonisation(); - - G4eMultipleScattering* msc = new G4eMultipleScattering; - G4UrbanMscModel* msc1 = new G4UrbanMscModel(); - G4WentzelVIModel* msc2 = new G4WentzelVIModel(); - G4GoudsmitSaundersonMscModel* msc3 = new G4GoudsmitSaundersonMscModel(); - msc3->SetStepLimitType(fUseSafetyPlus); - msc3->SetRangeFactor(0.08); - msc3->SetSkin(3.0); - msc1->SetHighEnergyLimit(highEnergyLimit); - msc2->SetLowEnergyLimit(highEnergyLimit); - msc3->SetHighEnergyLimit(highEnergyLimit); - msc3->SetLocked(true); - msc->SetEmModel(msc1); - msc->SetEmModel(msc2); - if (aRegion) - msc->AddEmModel(-1, msc3, aRegion); - if (bRegion) - msc->AddEmModel(-1, msc3, bRegion); - - G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel(); - G4CoulombScattering* ss = new G4CoulombScattering(); - ss->SetEmModel(ssm); - ss->SetMinKinEnergy(highEnergyLimit); - ssm->SetLowEnergyLimit(highEnergyLimit); - ssm->SetActivationLowEnergyLimit(highEnergyLimit); - - // bremsstrahlung - G4eBremsstrahlung* brem = new G4eBremsstrahlung(); - G4SeltzerBergerModel* br1 = new G4SeltzerBergerModel(); - G4eBremsstrahlungRelModel* br2 = new G4eBremsstrahlungRelModel(); - br1->SetAngularDistribution(new G4Generator2BS()); - br2->SetAngularDistribution(new G4Generator2BS()); - brem->SetEmModel(br1); - brem->SetEmModel(br2); - br1->SetHighEnergyLimit(GeV); - - if (!ee) { - ee = new G4ePairProduction(); - } - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(brem, particle); - ph->RegisterProcess(ee, particle); - ph->RegisterProcess(ss, particle); - - } else if (particleName == "e+") { - G4eIonisation* eioni = new G4eIonisation(); - - G4eMultipleScattering* msc = new G4eMultipleScattering; - G4UrbanMscModel* msc1 = new G4UrbanMscModel(); - G4WentzelVIModel* msc2 = new G4WentzelVIModel(); - G4GoudsmitSaundersonMscModel* msc3 = new G4GoudsmitSaundersonMscModel(); - msc3->SetStepLimitType(fUseSafetyPlus); - msc3->SetRangeFactor(0.08); - msc3->SetSkin(3.0); - msc1->SetHighEnergyLimit(highEnergyLimit); - msc2->SetLowEnergyLimit(highEnergyLimit); - msc3->SetHighEnergyLimit(highEnergyLimit); - msc3->SetLocked(true); - msc->SetEmModel(msc1); - msc->SetEmModel(msc2); - if (aRegion) - msc->AddEmModel(-1, msc3, aRegion); - if (bRegion) - msc->AddEmModel(-1, msc3, bRegion); - - G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel(); - G4CoulombScattering* ss = new G4CoulombScattering(); - ss->SetEmModel(ssm); - ss->SetMinKinEnergy(highEnergyLimit); - ssm->SetLowEnergyLimit(highEnergyLimit); - ssm->SetActivationLowEnergyLimit(highEnergyLimit); - - // bremsstrahlung - G4eBremsstrahlung* brem = new G4eBremsstrahlung(); - G4SeltzerBergerModel* br1 = new G4SeltzerBergerModel(); - G4eBremsstrahlungRelModel* br2 = new G4eBremsstrahlungRelModel(); - br1->SetAngularDistribution(new G4Generator2BS()); - br2->SetAngularDistribution(new G4Generator2BS()); - brem->SetEmModel(br1); - brem->SetEmModel(br2); - br1->SetHighEnergyLimit(GeV); - - if (!ee) { - ee = new G4ePairProduction(); - } - - ph->RegisterProcess(msc, particle); - ph->RegisterProcess(eioni, particle); - ph->RegisterProcess(brem, particle); - ph->RegisterProcess(new G4eplusAnnihilation(), particle); - ph->RegisterProcess(ee, particle); - ph->RegisterProcess(ss, particle); - - } else if (particleName == "mu+" || particleName == "mu-") { - if (nullptr == mub) { - mub = new G4MuBremsstrahlung(); - mup = new G4MuPairProduction(); - mumsc = new G4MuMultipleScattering(); - mumsc->SetEmModel(new G4WentzelVIModel()); - muss = new G4CoulombScattering(); - } - ph->RegisterProcess(mumsc, particle); - ph->RegisterProcess(new G4MuIonisation(), particle); - ph->RegisterProcess(mub, particle); - ph->RegisterProcess(mup, particle); - ph->RegisterProcess(muss, particle); - - } else if (particleName == "alpha" || particleName == "He3") { - ph->RegisterProcess(new G4hMultipleScattering(), particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "GenericIon") { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4ionIonisation(), particle); - - } else if (particleName == "pi+" || particleName == "pi-") { - if (nullptr == pib) { - pib = new G4hBremsstrahlung(); - pip = new G4hPairProduction(); - pimsc = new G4hMultipleScattering(); - pimsc->SetEmModel(new G4WentzelVIModel()); - piss = new G4CoulombScattering(); - } - ph->RegisterProcess(pimsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(pib, particle); - ph->RegisterProcess(pip, particle); - ph->RegisterProcess(piss, particle); - - } else if (particleName == "kaon+" || particleName == "kaon-") { - if (nullptr == kb) { - kb = new G4hBremsstrahlung(); - kp = new G4hPairProduction(); - kmsc = new G4hMultipleScattering(); - kmsc->SetEmModel(new G4WentzelVIModel()); - kss = new G4CoulombScattering(); - } - ph->RegisterProcess(kmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - ph->RegisterProcess(kb, particle); - ph->RegisterProcess(kp, particle); - ph->RegisterProcess(kss, particle); - - } else if (particleName == "proton" || particleName == "anti_proton") { - if (nullptr == pb) { - pb = new G4hBremsstrahlung(); - pp = new G4hPairProduction(); - } - G4hMultipleScattering* pmsc = new G4hMultipleScattering(); - pmsc->SetEmModel(new G4WentzelVIModel()); - G4hIonisation* hIoni = new G4hIonisation(); - G4CoulombScattering* pss = new G4CoulombScattering(); - - ph->RegisterProcess(pmsc, particle); - ph->RegisterProcess(hIoni, particle); - ph->RegisterProcess(pb, particle); - ph->RegisterProcess(pp, particle); - ph->RegisterProcess(pss, particle); - - } else if (particle->GetPDGCharge() != 0.0) { - if (nullptr == hmsc) { - hmsc = new G4hMultipleScattering("ionmsc"); - } - ph->RegisterProcess(hmsc, particle); - ph->RegisterProcess(new G4hIonisation(), particle); - } + // single scattering + G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel(); + G4CoulombScattering* ss = new G4CoulombScattering(); + ss->SetEmModel(ssm); + ss->SetMinKinEnergy(highEnergyLimit); + ssm->SetLowEnergyLimit(highEnergyLimit); + ssm->SetActivationLowEnergyLimit(highEnergyLimit); + + // ionisation + G4eIonisation* eioni = new G4eIonisation(); + + // bremsstrahlung + G4eBremsstrahlung* brem = new G4eBremsstrahlung(); + G4SeltzerBergerModel* br1 = new G4SeltzerBergerModel(); + G4eBremsstrahlungRelModel* br2 = new G4eBremsstrahlungRelModel(); + br1->SetAngularDistribution(new G4Generator2BS()); + br2->SetAngularDistribution(new G4Generator2BS()); + brem->SetEmModel(br1); + brem->SetEmModel(br2); + br1->SetHighEnergyLimit(CLHEP::GeV); + + // register processes + ph->RegisterProcess(msc, particle); + ph->RegisterProcess(eioni, particle); + ph->RegisterProcess(brem, particle); + ph->RegisterProcess(ee, particle); + ph->RegisterProcess(ss, particle); + + // e+ + particle = G4Positron::Positron(); + + // multiple scattering + msc = new G4eMultipleScattering(); + msc1 = new G4UrbanMscModel(); + msc2 = new G4WentzelVIModel(); + msc4 = new G4UrbanMscModel(); + msc3 = new G4GoudsmitSaundersonMscModel(); + msc1->SetHighEnergyLimit(highEnergyLimit); + msc2->SetLowEnergyLimit(highEnergyLimit); + msc3->SetHighEnergyLimit(highEnergyLimit); + msc4->SetHighEnergyLimit(highEnergyLimit); + + // e-/e+ msc GS with Mott-correction + // (Mott-correction is set through G4EmParameters) + msc3->SetRangeFactor(0.08); + msc3->SetSkin(3.); + msc3->SetStepLimitType(fUseSafetyPlus); + + // e-/e+ msc for HCAL using the Urban model + msc4->SetRangeFactor(fRangeFactor); + msc4->SetGeomFactor(fGeomFactor); + msc4->SetSafetyFactor(fSafetyFactor); + msc4->SetLambdaLimit(fLambdaLimit); + msc4->SetStepLimitType(fStepLimitType); + + msc3->SetLocked(true); + msc4->SetLocked(true); + msc->SetEmModel(msc1); + msc->SetEmModel(msc2); + if (nullptr != aRegion) { + msc->AddEmModel(-1, msc4, aRegion); } - // Deexcitation - // - G4VAtomDeexcitation* de = new G4UAtomicDeexcitation(); - G4LossTableManager::Instance()->SetAtomDeexcitation(de); + if (nullptr != bRegion) { + msc->AddEmModel(-1, msc3, bRegion); + } + + // single scattering + ssm = new G4eCoulombScatteringModel(); + ss = new G4CoulombScattering(); + ss->SetEmModel(ssm); + ss->SetMinKinEnergy(highEnergyLimit); + ssm->SetLowEnergyLimit(highEnergyLimit); + ssm->SetActivationLowEnergyLimit(highEnergyLimit); + + // ionisation + eioni = new G4eIonisation(); + + // bremsstrahlung + brem = new G4eBremsstrahlung(); + br1 = new G4SeltzerBergerModel(); + br2 = new G4eBremsstrahlungRelModel(); + br1->SetAngularDistribution(new G4Generator2BS()); + br2->SetAngularDistribution(new G4Generator2BS()); + brem->SetEmModel(br1); + brem->SetEmModel(br2); + br1->SetHighEnergyLimit(CLHEP::GeV); + + // register processes + ph->RegisterProcess(msc, particle); + ph->RegisterProcess(eioni, particle); + ph->RegisterProcess(brem, particle); + ph->RegisterProcess(ee, particle); + ph->RegisterProcess(new G4eplusAnnihilation(), particle); + ph->RegisterProcess(ss, particle); + + // generic ion + particle = G4GenericIon::GenericIon(); + G4ionIonisation* ionIoni = new G4ionIonisation(); + ph->RegisterProcess(hmsc, particle); + ph->RegisterProcess(ionIoni, particle); + + // muons, hadrons, ions + G4EmBuilder::ConstructCharged(hmsc, pnuc); } diff --git a/SimG4Core/PhysicsLists/src/CMSFTFPNeutronBuilder.cc b/SimG4Core/PhysicsLists/src/CMSFTFPNeutronBuilder.cc deleted file mode 100644 index ec198d51f17d6..0000000000000 --- a/SimG4Core/PhysicsLists/src/CMSFTFPNeutronBuilder.cc +++ /dev/null @@ -1,55 +0,0 @@ -#include "SimG4Core/PhysicsLists/interface/CMSFTFPNeutronBuilder.hh" -#include "G4ParticleDefinition.hh" -#include "G4ParticleTable.hh" -#include "G4ProcessManager.hh" -#include "G4NeutronInelasticCrossSection.hh" -#include "G4SystemOfUnits.hh" - -CMSFTFPNeutronBuilder::CMSFTFPNeutronBuilder(G4bool quasiElastic) { - theMin = 4 * GeV; - theMax = 100 * TeV; - theModel = new G4TheoFSGenerator("FTFP"); - - theStringModel = new G4FTFModel; - theStringDecay = new G4ExcitedStringDecay(new G4LundStringFragmentation); - theStringModel->SetFragmentationModel(theStringDecay); - - theCascade = new G4GeneratorPrecompoundInterface; - thePreEquilib = new G4PreCompoundModel(new G4ExcitationHandler); - theCascade->SetDeExcitation(thePreEquilib); - - theModel->SetTransport(theCascade); - - theModel->SetHighEnergyGenerator(theStringModel); - if (quasiElastic) { - theQuasiElastic = new G4QuasiElasticChannel; - theModel->SetQuasiElasticChannel(theQuasiElastic); - } else { - theQuasiElastic = nullptr; - } - - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(100 * TeV); -} - -CMSFTFPNeutronBuilder::~CMSFTFPNeutronBuilder() { - delete theStringDecay; - delete theStringModel; - delete thePreEquilib; - delete theCascade; - if (theQuasiElastic) - delete theQuasiElastic; -} - -void CMSFTFPNeutronBuilder::Build(G4HadronElasticProcess*) {} - -void CMSFTFPNeutronBuilder::Build(G4HadronFissionProcess*) {} - -void CMSFTFPNeutronBuilder::Build(G4HadronCaptureProcess*) {} - -void CMSFTFPNeutronBuilder::Build(G4NeutronInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->RegisterMe(theModel); - aP->AddDataSet(new G4NeutronInelasticCrossSection); -} diff --git a/SimG4Core/PhysicsLists/src/CMSFTFPPiKBuilder.cc b/SimG4Core/PhysicsLists/src/CMSFTFPPiKBuilder.cc deleted file mode 100644 index 293131d9fe015..0000000000000 --- a/SimG4Core/PhysicsLists/src/CMSFTFPPiKBuilder.cc +++ /dev/null @@ -1,81 +0,0 @@ -#include "SimG4Core/PhysicsLists/interface/CMSFTFPPiKBuilder.hh" -#include "G4ParticleDefinition.hh" -#include "G4ParticleTable.hh" -#include "G4ProcessManager.hh" -#include "G4SystemOfUnits.hh" - -CMSFTFPPiKBuilder::CMSFTFPPiKBuilder(G4bool quasiElastic) { - thePiData = new G4PiNuclearCrossSection; - theMin = 4 * GeV; - theMax = 100 * TeV; - theModel = new G4TheoFSGenerator("FTFP"); - - theStringModel = new G4FTFModel; - theStringDecay = new G4ExcitedStringDecay(new G4LundStringFragmentation); - theStringModel->SetFragmentationModel(theStringDecay); - - theCascade = new G4GeneratorPrecompoundInterface; - thePreEquilib = new G4PreCompoundModel(new G4ExcitationHandler); - theCascade->SetDeExcitation(thePreEquilib); - - theModel->SetHighEnergyGenerator(theStringModel); - if (quasiElastic) { - theQuasiElastic = new G4QuasiElasticChannel; - theModel->SetQuasiElasticChannel(theQuasiElastic); - } else { - theQuasiElastic = nullptr; - } - - theModel->SetTransport(theCascade); - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(100 * TeV); -} - -CMSFTFPPiKBuilder::~CMSFTFPPiKBuilder() { - delete theCascade; - delete theStringDecay; - delete theStringModel; - delete theModel; - if (theQuasiElastic) - delete theQuasiElastic; -} - -void CMSFTFPPiKBuilder::Build(G4HadronElasticProcess*) {} - -void CMSFTFPPiKBuilder::Build(G4PionPlusInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->AddDataSet(thePiData); - aP->RegisterMe(theModel); -} - -void CMSFTFPPiKBuilder::Build(G4PionMinusInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->AddDataSet(thePiData); - aP->RegisterMe(theModel); -} - -void CMSFTFPPiKBuilder::Build(G4KaonPlusInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->RegisterMe(theModel); -} - -void CMSFTFPPiKBuilder::Build(G4KaonMinusInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->RegisterMe(theModel); -} - -void CMSFTFPPiKBuilder::Build(G4KaonZeroLInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->RegisterMe(theModel); -} - -void CMSFTFPPiKBuilder::Build(G4KaonZeroSInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->RegisterMe(theModel); -} diff --git a/SimG4Core/PhysicsLists/src/CMSFTFPProtonBuilder.cc b/SimG4Core/PhysicsLists/src/CMSFTFPProtonBuilder.cc deleted file mode 100644 index 6ccc5ef4d8ed0..0000000000000 --- a/SimG4Core/PhysicsLists/src/CMSFTFPProtonBuilder.cc +++ /dev/null @@ -1,50 +0,0 @@ -#include "SimG4Core/PhysicsLists/interface/CMSFTFPProtonBuilder.hh" -#include "G4ParticleDefinition.hh" -#include "G4ParticleTable.hh" -#include "G4ProcessManager.hh" -#include "G4ProtonInelasticCrossSection.hh" -#include "G4SystemOfUnits.hh" - -CMSFTFPProtonBuilder::CMSFTFPProtonBuilder(G4bool quasiElastic) { - theMin = 4 * GeV; - theMax = 100. * TeV; - theModel = new G4TheoFSGenerator("FTFP"); - - theStringModel = new G4FTFModel; - theStringDecay = new G4ExcitedStringDecay(new G4LundStringFragmentation); - theStringModel->SetFragmentationModel(theStringDecay); - - theCascade = new G4GeneratorPrecompoundInterface; - thePreEquilib = new G4PreCompoundModel(new G4ExcitationHandler); - theCascade->SetDeExcitation(thePreEquilib); - - theModel->SetHighEnergyGenerator(theStringModel); - if (quasiElastic) { - theQuasiElastic = new G4QuasiElasticChannel; - theModel->SetQuasiElasticChannel(theQuasiElastic); - } else { - theQuasiElastic = nullptr; - } - - theModel->SetTransport(theCascade); - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(100 * TeV); -} - -void CMSFTFPProtonBuilder::Build(G4ProtonInelasticProcess* aP) { - theModel->SetMinEnergy(theMin); - theModel->SetMaxEnergy(theMax); - aP->RegisterMe(theModel); - aP->AddDataSet(new G4ProtonInelasticCrossSection); -} - -CMSFTFPProtonBuilder::~CMSFTFPProtonBuilder() { - delete theStringDecay; - delete theStringModel; - delete theModel; - delete theCascade; - if (theQuasiElastic) - delete theQuasiElastic; -} - -void CMSFTFPProtonBuilder::Build(G4HadronElasticProcess*) {} diff --git a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc index 3992e8ea30c9e..5c098b3c7c108 100644 --- a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc +++ b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc @@ -1,192 +1,28 @@ -#include - #include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" -#include "SimG4Core/PhysicsLists/interface/CMSHyperonFTFPBuilder.h" - -#include "globals.hh" -#include "G4ios.hh" #include "G4SystemOfUnits.hh" -#include "G4ParticleDefinition.hh" -#include "G4ParticleTable.hh" -#include "G4PionBuilder.hh" -#include "G4BertiniPionBuilder.hh" -#include "G4FTFPPionBuilder.hh" - -#include "G4KaonBuilder.hh" -#include "G4BertiniKaonBuilder.hh" -#include "G4FTFPKaonBuilder.hh" - -#include "G4ProtonBuilder.hh" -#include "G4BertiniProtonBuilder.hh" -#include "G4FTFPNeutronBuilder.hh" -#include "G4FTFPProtonBuilder.hh" - -#include "G4NeutronBuilder.hh" -#include "G4BertiniNeutronBuilder.hh" -#include "G4FTFPNeutronBuilder.hh" - -#include "G4HyperonFTFPBuilder.hh" -#include "G4AntiBarionBuilder.hh" -#include "G4FTFPAntiBarionBuilder.hh" - -#include "G4MesonConstructor.hh" -#include "G4BaryonConstructor.hh" -#include "G4ShortLivedConstructor.hh" - -#include "G4HadronCaptureProcess.hh" -#include "G4NeutronRadCapture.hh" -#include "G4NeutronInelasticXS.hh" -#include "G4NeutronCaptureXS.hh" - -#include "G4PhysListUtil.hh" #include "G4Threading.hh" -#include "G4DeexPrecoParameters.hh" -#include "G4NuclearLevelData.hh" - -#include "G4ProcessManager.hh" - CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4int) : CMSHadronPhysicsFTFP_BERT(3. * CLHEP::GeV, 6. * CLHEP::GeV, 12 * CLHEP::GeV) {} CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3) - : G4VPhysicsConstructor("hInelastic FTFP_BERT") { - minFTFP_ = e1; - maxBERT_ = e2; - maxBERTpi_ = e3; + : G4HadronPhysicsFTFP_BERT("hInelastic FTFP_BERT", false) { + minFTFP_pion = e1; + maxBERT_pion = e3; + minFTFP_kaon = e1; + maxBERT_kaon = e2; + minFTFP_proton = e1; + maxBERT_proton = e2; + minFTFP_neutron = e1; + maxBERT_neutron = e2; } CMSHadronPhysicsFTFP_BERT::~CMSHadronPhysicsFTFP_BERT() {} -void CMSHadronPhysicsFTFP_BERT::ConstructParticle() { - G4MesonConstructor pMesonConstructor; - pMesonConstructor.ConstructParticle(); - - G4BaryonConstructor pBaryonConstructor; - pBaryonConstructor.ConstructParticle(); - - G4ShortLivedConstructor pShortLivedConstructor; - pShortLivedConstructor.ConstructParticle(); -} - -void CMSHadronPhysicsFTFP_BERT::DumpBanner() { - G4cout << "### FTFP_BERT : transition between BERT and FTFP is over the interval " << minFTFP_ / CLHEP::GeV << " to " - << maxBERT_ / CLHEP::GeV << " GeV" - << " GeV; for pions up to " << maxBERTpi_ / CLHEP::GeV << " GeV" << G4endl; -} - -void CMSHadronPhysicsFTFP_BERT::CreateModels() { - Neutron(); - Proton(); - Pion(); - Kaon(); - Others(); -} - -void CMSHadronPhysicsFTFP_BERT::Neutron() { - //General schema: - // 1) Create a builder - // 2) Call AddBuilder - // 3) Configure the builder, possibly with sub-builders - // 4) Call builder->Build() - auto neu = new G4NeutronBuilder; - AddBuilder(neu); - auto ftfpn = new G4FTFPNeutronBuilder(false); - AddBuilder(ftfpn); - neu->RegisterMe(ftfpn); - ftfpn->SetMinEnergy(minFTFP_); - auto bertn = new G4BertiniNeutronBuilder; - AddBuilder(bertn); - neu->RegisterMe(bertn); - bertn->SetMinEnergy(0.0); - bertn->SetMaxEnergy(maxBERT_); - neu->Build(); -} - -void CMSHadronPhysicsFTFP_BERT::Proton() { - auto pro = new G4ProtonBuilder; - AddBuilder(pro); - auto ftfpp = new G4FTFPProtonBuilder(false); - AddBuilder(ftfpp); - pro->RegisterMe(ftfpp); - ftfpp->SetMinEnergy(minFTFP_); - auto bertp = new G4BertiniProtonBuilder; - AddBuilder(bertp); - pro->RegisterMe(bertp); - bertp->SetMaxEnergy(maxBERT_); - pro->Build(); -} - -void CMSHadronPhysicsFTFP_BERT::Pion() { - auto pi = new G4PionBuilder; - AddBuilder(pi); - auto ftfppi = new G4FTFPPionBuilder(false); - AddBuilder(ftfppi); - pi->RegisterMe(ftfppi); - ftfppi->SetMinEnergy(minFTFP_); - auto bertpi = new G4BertiniPionBuilder; - AddBuilder(bertpi); - pi->RegisterMe(bertpi); - bertpi->SetMaxEnergy(maxBERTpi_); - pi->Build(); -} - -void CMSHadronPhysicsFTFP_BERT::Kaon() { - auto k = new G4KaonBuilder; - AddBuilder(k); - auto ftfpk = new G4FTFPKaonBuilder(false); - AddBuilder(ftfpk); - k->RegisterMe(ftfpk); - ftfpk->SetMinEnergy(minFTFP_); - auto bertk = new G4BertiniKaonBuilder; - AddBuilder(bertk); - k->RegisterMe(bertk); - bertk->SetMaxEnergy(maxBERT_); - k->Build(); -} - -void CMSHadronPhysicsFTFP_BERT::Others() { - //===== Hyperons ====== // - auto hyp = new CMSHyperonFTFPBuilder; - AddBuilder(hyp); - hyp->Build(); - - ///===== Anti-barions==== // - auto abar = new G4AntiBarionBuilder; - AddBuilder(abar); - auto ftfpabar = new G4FTFPAntiBarionBuilder(false); - AddBuilder(ftfpabar); - abar->RegisterMe(ftfpabar); - abar->Build(); -} - void CMSHadronPhysicsFTFP_BERT::ConstructProcess() { if (G4Threading::IsMasterThread()) { DumpBanner(); } CreateModels(); - ExtraConfiguration(); -} - -void CMSHadronPhysicsFTFP_BERT::ExtraConfiguration() { - const G4ParticleDefinition* neutron = G4Neutron::Neutron(); - G4HadronicProcess* inel = G4PhysListUtil::FindInelasticProcess(neutron); - if (inel) { - inel->AddDataSet(new G4NeutronInelasticXS()); - } - - G4HadronicProcess* capture = nullptr; - G4ProcessVector* pvec = neutron->GetProcessManager()->GetProcessList(); - size_t n = pvec->size(); - for (size_t i = 0; i < n; ++i) { - if (fCapture == ((*pvec)[i])->GetProcessSubType()) { - capture = static_cast((*pvec)[i]); - break; - } - } - if (capture) { - capture->RegisterMe(new G4NeutronRadCapture()); - capture->AddDataSet(new G4NeutronCaptureXS()); - } } diff --git a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT106.cc b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT106.cc new file mode 100644 index 0000000000000..a16def236b433 --- /dev/null +++ b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT106.cc @@ -0,0 +1,192 @@ + +#include + +#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h" +#include "SimG4Core/PhysicsLists/interface/CMSHyperonFTFPBuilder.h" + +#include "globals.hh" +#include "G4ios.hh" +#include "G4SystemOfUnits.hh" +#include "G4ParticleDefinition.hh" +#include "G4ParticleTable.hh" +#include "G4PionBuilder.hh" +#include "G4BertiniPionBuilder.hh" +#include "G4FTFPPionBuilder.hh" + +#include "G4KaonBuilder.hh" +#include "G4BertiniKaonBuilder.hh" +#include "G4FTFPKaonBuilder.hh" + +#include "G4ProtonBuilder.hh" +#include "G4BertiniProtonBuilder.hh" +#include "G4FTFPNeutronBuilder.hh" +#include "G4FTFPProtonBuilder.hh" + +#include "G4NeutronBuilder.hh" +#include "G4BertiniNeutronBuilder.hh" +#include "G4FTFPNeutronBuilder.hh" + +#include "G4HyperonFTFPBuilder.hh" +#include "G4AntiBarionBuilder.hh" +#include "G4FTFPAntiBarionBuilder.hh" + +#include "G4MesonConstructor.hh" +#include "G4BaryonConstructor.hh" +#include "G4ShortLivedConstructor.hh" + +#include "G4HadronCaptureProcess.hh" +#include "G4NeutronRadCapture.hh" +#include "G4NeutronInelasticXS.hh" +#include "G4NeutronCaptureXS.hh" + +#include "G4PhysListUtil.hh" +#include "G4Threading.hh" + +#include "G4DeexPrecoParameters.hh" +#include "G4NuclearLevelData.hh" + +#include "G4ProcessManager.hh" + +CMSHadronPhysicsFTFP_BERT106::CMSHadronPhysicsFTFP_BERT106(G4int) + : CMSHadronPhysicsFTFP_BERT106(3. * CLHEP::GeV, 6. * CLHEP::GeV, 12 * CLHEP::GeV) {} + +CMSHadronPhysicsFTFP_BERT106::CMSHadronPhysicsFTFP_BERT106(G4double e1, G4double e2, G4double e3) + : G4VPhysicsConstructor("hInelastic FTFP_BERT") { + minFTFP_ = e1; + maxBERT_ = e2; + maxBERTpi_ = e3; +} + +CMSHadronPhysicsFTFP_BERT106::~CMSHadronPhysicsFTFP_BERT106() {} + +void CMSHadronPhysicsFTFP_BERT106::ConstructParticle() { + G4MesonConstructor pMesonConstructor; + pMesonConstructor.ConstructParticle(); + + G4BaryonConstructor pBaryonConstructor; + pBaryonConstructor.ConstructParticle(); + + G4ShortLivedConstructor pShortLivedConstructor; + pShortLivedConstructor.ConstructParticle(); +} + +void CMSHadronPhysicsFTFP_BERT106::DumpBanner() { + G4cout << "### FTFP_BERT : transition between BERT and FTFP is over the interval " << minFTFP_ / CLHEP::GeV << " to " + << maxBERT_ / CLHEP::GeV << " GeV" + << " GeV; for pions up to " << maxBERTpi_ / CLHEP::GeV << " GeV" << G4endl; +} + +void CMSHadronPhysicsFTFP_BERT106::CreateModels() { + Neutron(); + Proton(); + Pion(); + Kaon(); + Others(); +} + +void CMSHadronPhysicsFTFP_BERT106::Neutron() { + //General schema: + // 1) Create a builder + // 2) Call AddBuilder + // 3) Configure the builder, possibly with sub-builders + // 4) Call builder->Build() + auto neu = new G4NeutronBuilder; + AddBuilder(neu); + auto ftfpn = new G4FTFPNeutronBuilder(false); + AddBuilder(ftfpn); + neu->RegisterMe(ftfpn); + ftfpn->SetMinEnergy(minFTFP_); + auto bertn = new G4BertiniNeutronBuilder; + AddBuilder(bertn); + neu->RegisterMe(bertn); + bertn->SetMinEnergy(0.0); + bertn->SetMaxEnergy(maxBERT_); + neu->Build(); +} + +void CMSHadronPhysicsFTFP_BERT106::Proton() { + auto pro = new G4ProtonBuilder; + AddBuilder(pro); + auto ftfpp = new G4FTFPProtonBuilder(false); + AddBuilder(ftfpp); + pro->RegisterMe(ftfpp); + ftfpp->SetMinEnergy(minFTFP_); + auto bertp = new G4BertiniProtonBuilder; + AddBuilder(bertp); + pro->RegisterMe(bertp); + bertp->SetMaxEnergy(maxBERT_); + pro->Build(); +} + +void CMSHadronPhysicsFTFP_BERT106::Pion() { + auto pi = new G4PionBuilder; + AddBuilder(pi); + auto ftfppi = new G4FTFPPionBuilder(false); + AddBuilder(ftfppi); + pi->RegisterMe(ftfppi); + ftfppi->SetMinEnergy(minFTFP_); + auto bertpi = new G4BertiniPionBuilder; + AddBuilder(bertpi); + pi->RegisterMe(bertpi); + bertpi->SetMaxEnergy(maxBERTpi_); + pi->Build(); +} + +void CMSHadronPhysicsFTFP_BERT106::Kaon() { + auto k = new G4KaonBuilder; + AddBuilder(k); + auto ftfpk = new G4FTFPKaonBuilder(false); + AddBuilder(ftfpk); + k->RegisterMe(ftfpk); + ftfpk->SetMinEnergy(minFTFP_); + auto bertk = new G4BertiniKaonBuilder; + AddBuilder(bertk); + k->RegisterMe(bertk); + bertk->SetMaxEnergy(maxBERT_); + k->Build(); +} + +void CMSHadronPhysicsFTFP_BERT106::Others() { + //===== Hyperons ====== // + auto hyp = new CMSHyperonFTFPBuilder; + AddBuilder(hyp); + hyp->Build(); + + ///===== Anti-barions==== // + auto abar = new G4AntiBarionBuilder; + AddBuilder(abar); + auto ftfpabar = new G4FTFPAntiBarionBuilder(false); + AddBuilder(ftfpabar); + abar->RegisterMe(ftfpabar); + abar->Build(); +} + +void CMSHadronPhysicsFTFP_BERT106::ConstructProcess() { + if (G4Threading::IsMasterThread()) { + DumpBanner(); + } + CreateModels(); + ExtraConfiguration(); +} + +void CMSHadronPhysicsFTFP_BERT106::ExtraConfiguration() { + const G4ParticleDefinition* neutron = G4Neutron::Neutron(); + G4HadronicProcess* inel = G4PhysListUtil::FindInelasticProcess(neutron); + if (inel) { + inel->AddDataSet(new G4NeutronInelasticXS()); + } + + G4HadronicProcess* capture = nullptr; + G4ProcessVector* pvec = neutron->GetProcessManager()->GetProcessList(); + size_t n = pvec->size(); + for (size_t i = 0; i < n; ++i) { + if (fCapture == ((*pvec)[i])->GetProcessSubType()) { + capture = static_cast((*pvec)[i]); + break; + } + } + if (capture) { + capture->RegisterMe(new G4NeutronRadCapture()); + capture->AddDataSet(new G4NeutronCaptureXS()); + } +} diff --git a/SimG4Core/PhysicsLists/src/HadronPhysicsQGSPCMS_FTFP_BERT.cc b/SimG4Core/PhysicsLists/src/HadronPhysicsQGSPCMS_FTFP_BERT.cc index af8f4efe50519..a7f3f2e046ad4 100644 --- a/SimG4Core/PhysicsLists/src/HadronPhysicsQGSPCMS_FTFP_BERT.cc +++ b/SimG4Core/PhysicsLists/src/HadronPhysicsQGSPCMS_FTFP_BERT.cc @@ -1,214 +1,26 @@ #include "SimG4Core/PhysicsLists/interface/HadronPhysicsQGSPCMS_FTFP_BERT.h" -#include "SimG4Core/PhysicsLists/interface/CMSHyperonFTFPBuilder.h" - -#include "globals.hh" -#include "G4ios.hh" #include "G4SystemOfUnits.hh" -#include "G4ParticleDefinition.hh" -#include "G4ParticleTable.hh" - -#include "G4PionBuilder.hh" -#include "G4FTFPPionBuilder.hh" -#include "G4QGSPPionBuilder.hh" -#include "G4BertiniPionBuilder.hh" - -#include "G4KaonBuilder.hh" -#include "G4FTFPKaonBuilder.hh" -#include "G4QGSPKaonBuilder.hh" -#include "G4BertiniKaonBuilder.hh" - -#include "G4ProtonBuilder.hh" -#include "G4FTFPProtonBuilder.hh" -#include "G4QGSPProtonBuilder.hh" -#include "G4BertiniProtonBuilder.hh" - -#include "G4NeutronBuilder.hh" -#include "G4FTFPNeutronBuilder.hh" -#include "G4QGSPNeutronBuilder.hh" -#include "G4BertiniNeutronBuilder.hh" - -#include "G4HyperonFTFPBuilder.hh" -#include "G4AntiBarionBuilder.hh" -#include "G4FTFPAntiBarionBuilder.hh" -#include "G4MesonConstructor.hh" -#include "G4BaryonConstructor.hh" -#include "G4ShortLivedConstructor.hh" -#include "G4IonConstructor.hh" - -#include "G4HadronCaptureProcess.hh" -#include "G4NeutronRadCapture.hh" -#include "G4NeutronInelasticXS.hh" -#include "G4NeutronCaptureXS.hh" -#include "G4CrossSectionDataSetRegistry.hh" - -#include "G4PhysListUtil.hh" -#include "G4ProcessManager.hh" +#include "G4Threading.hh" HadronPhysicsQGSPCMS_FTFP_BERT::HadronPhysicsQGSPCMS_FTFP_BERT(G4int) - : HadronPhysicsQGSPCMS_FTFP_BERT(3., 6., 12., 25., 12.) {} + : HadronPhysicsQGSPCMS_FTFP_BERT( + 3. * CLHEP::GeV, 6. * CLHEP::GeV, 12. * CLHEP::GeV, 25. * CLHEP::GeV, 12. * CLHEP::GeV) {} HadronPhysicsQGSPCMS_FTFP_BERT::HadronPhysicsQGSPCMS_FTFP_BERT( G4double e1, G4double e2, G4double e3, G4double e4, G4double e5) - : G4VPhysicsConstructor("hInelasticQGSPCMS_FTFP_BERT") { - minFTFP_ = e1; - maxBERT_ = e2; - minQGSP_ = e3; - maxFTFP_ = e4; - maxBERTpi_ = e5; + : G4HadronPhysicsQGSP_BERT("hInelasticQGSPCMS_FTFP_BERT") { + minQGSP_proton = minQGSP_neutron = minQGSP_pik = e5; + maxFTFP_proton = maxFTFP_neutron = maxFTFP_pik = e4; + minFTFP_proton = minFTFP_neutron = minFTFP_pik = e1; + maxBERT_proton = maxBERT_neutron = e2; + maxBERT_pik = e3; } HadronPhysicsQGSPCMS_FTFP_BERT::~HadronPhysicsQGSPCMS_FTFP_BERT() {} -void HadronPhysicsQGSPCMS_FTFP_BERT::ConstructParticle() { - G4MesonConstructor pMesonConstructor; - pMesonConstructor.ConstructParticle(); - - G4BaryonConstructor pBaryonConstructor; - pBaryonConstructor.ConstructParticle(); - - G4ShortLivedConstructor pShortLivedConstructor; - pShortLivedConstructor.ConstructParticle(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::DumpBanner() { - G4cout << "### QGSP_FTFP_BERT : transition between BERT and FTFP is over the interval " << minFTFP_ / CLHEP::GeV - << " to " << maxBERT_ / CLHEP::GeV << " GeV" - << " transition between FTFP and QGSP is over the interval " << minQGSP_ / CLHEP::GeV - << " to " << maxFTFP_ / CLHEP::GeV << G4endl; -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::CreateModels() { - Neutron(); - Proton(); - Pion(); - Kaon(); - Others(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::Neutron() { - //General schema: - // 1) Create a builder - // 2) Call AddBuilder - // 3) Configure the builder, possibly with sub-builders - // 4) Call builder->Build() - auto neu = new G4NeutronBuilder; - AddBuilder(neu); - auto qgs = new G4QGSPNeutronBuilder(true); - AddBuilder(qgs); - qgs->SetMinEnergy(minQGSP_); - neu->RegisterMe(qgs); - auto ftf = new G4FTFPNeutronBuilder(false); - AddBuilder(ftf); - ftf->SetMinEnergy(minFTFP_); - ftf->SetMaxEnergy(maxFTFP_); - neu->RegisterMe(ftf); - auto bert = new G4BertiniNeutronBuilder; - AddBuilder(bert); - bert->SetMinEnergy(0.0); - bert->SetMaxEnergy(maxBERT_); - neu->RegisterMe(bert); - neu->Build(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::Proton() { - auto pro = new G4ProtonBuilder; - AddBuilder(pro); - auto qgs = new G4QGSPProtonBuilder(true); - AddBuilder(qgs); - qgs->SetMinEnergy(minQGSP_); - pro->RegisterMe(qgs); - auto ftf = new G4FTFPProtonBuilder(false); - AddBuilder(ftf); - ftf->SetMinEnergy(minFTFP_); - ftf->SetMaxEnergy(maxFTFP_); - pro->RegisterMe(ftf); - auto bert = new G4BertiniProtonBuilder; - AddBuilder(bert); - bert->SetMinEnergy(0.0); - bert->SetMaxEnergy(maxBERT_); - pro->RegisterMe(bert); - pro->Build(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::Pion() { - auto pi = new G4PionBuilder; - AddBuilder(pi); - auto qgs = new G4QGSPPionBuilder(true); - AddBuilder(qgs); - qgs->SetMinEnergy(minQGSP_); - pi->RegisterMe(qgs); - auto ftf = new G4FTFPPionBuilder(false); - AddBuilder(ftf); - ftf->SetMinEnergy(minFTFP_); - ftf->SetMaxEnergy(maxFTFP_); - pi->RegisterMe(ftf); - auto bert = new G4BertiniPionBuilder; - AddBuilder(bert); - bert->SetMinEnergy(0.0); - bert->SetMaxEnergy(maxBERTpi_); - pi->RegisterMe(bert); - pi->Build(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::Kaon() { - auto k = new G4KaonBuilder; - AddBuilder(k); - auto qgs = new G4QGSPKaonBuilder(true); - AddBuilder(qgs); - qgs->SetMinEnergy(minQGSP_); - k->RegisterMe(qgs); - auto ftf = new G4FTFPKaonBuilder(false); - AddBuilder(ftf); - k->RegisterMe(ftf); - ftf->SetMinEnergy(minFTFP_); - ftf->SetMaxEnergy(maxFTFP_); - auto bert = new G4BertiniKaonBuilder; - AddBuilder(bert); - k->RegisterMe(bert); - bert->SetMaxEnergy(maxBERT_); - bert->SetMinEnergy(0.0); - k->Build(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::Others() { - auto hyp = new CMSHyperonFTFPBuilder(); - AddBuilder(hyp); - hyp->Build(); - - auto abar = new G4AntiBarionBuilder(); - AddBuilder(abar); - auto ftf = new G4FTFPAntiBarionBuilder(false); - AddBuilder(ftf); - abar->RegisterMe(ftf); - abar->Build(); -} - void HadronPhysicsQGSPCMS_FTFP_BERT::ConstructProcess() { if (G4Threading::IsMasterThread()) { DumpBanner(); } CreateModels(); - ExtraConfiguration(); -} - -void HadronPhysicsQGSPCMS_FTFP_BERT::ExtraConfiguration() { - const G4ParticleDefinition* neutron = G4Neutron::Neutron(); - G4HadronicProcess* inel = G4PhysListUtil::FindInelasticProcess(neutron); - if (inel) { - inel->AddDataSet(new G4NeutronInelasticXS()); - } - - G4HadronicProcess* capture = nullptr; - G4ProcessVector* pvec = neutron->GetProcessManager()->GetProcessList(); - size_t n = pvec->size(); - for (size_t i = 0; i < n; ++i) { - if (fCapture == ((*pvec)[i])->GetProcessSubType()) { - capture = static_cast((*pvec)[i]); - break; - } - } - if (capture) { - capture->RegisterMe(new G4NeutronRadCapture()); - capture->AddDataSet(new G4NeutronCaptureXS()); - } } diff --git a/SimG4Core/PhysicsLists/src/UrbanMscModel93.cc b/SimG4Core/PhysicsLists/src/UrbanMscModel93.cc deleted file mode 100644 index bfcdf56b8d946..0000000000000 --- a/SimG4Core/PhysicsLists/src/UrbanMscModel93.cc +++ /dev/null @@ -1,1020 +0,0 @@ -// ------------------------------------------------------------------- -// -// GEANT4 Class file -// -// -// File name: UrbanMscModel93 -// -// Original author: Laszlo Urban, -// -// V.Ivanchenko have copied from G4UrbanMscModel93 class -// of Geant4 global tag geant4-09-06-ref-07 -// and have adopted to CMSSW -// -// ------------------------------------------------------------------- -// - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -#include "SimG4Core/PhysicsLists/interface/UrbanMscModel93.h" -#include "CLHEP/Units/PhysicalConstants.h" -#include "Randomize.hh" -#include "G4Electron.hh" -#include "G4LossTableManager.hh" -#include "G4ParticleChangeForMSC.hh" - -#include "G4Poisson.hh" -#include "globals.hh" - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -using namespace std; -using namespace CLHEP; - -static const G4double kappa = 2.5; -static const G4double kappapl1 = 3.5; -static const G4double kappami1 = 1.5; - -UrbanMscModel93::UrbanMscModel93(const G4String& nam) : G4VMscModel(nam) { - masslimite = 0.6 * MeV; - lambdalimit = 1. * mm; - fr = 0.02; - taubig = 8.0; - tausmall = 1.e-16; - taulim = 1.e-6; - currentTau = taulim; - tlimitminfix = 1.e-6 * mm; - stepmin = tlimitminfix; - smallstep = 1.e10; - currentRange = 0.; - rangeinit = 0.; - tlimit = 1.e10 * mm; - tlimitmin = 10. * tlimitminfix; - tgeom = 1.e50 * mm; - geombig = 1.e50 * mm; - geommin = 1.e-3 * mm; - geomlimit = geombig; - presafety = 0. * mm; - - y = 0.; - - Zold = 0.; - Zeff = 1.; - Z2 = 1.; - Z23 = 1.; - lnZ = 0.; - coeffth1 = 0.; - coeffth2 = 0.; - coeffc1 = 0.; - coeffc2 = 0.; - scr1ini = - fine_structure_const * fine_structure_const * electron_mass_c2 * electron_mass_c2 / (0.885 * 0.885 * 4. * pi); - scr2ini = 3.76 * fine_structure_const * fine_structure_const; - scr1 = 0.; - scr2 = 0.; - - theta0max = pi / 6.; - rellossmax = 0.50; - third = 1. / 3.; - particle = nullptr; - theManager = G4LossTableManager::Instance(); - firstStep = true; - inside = false; - insideskin = false; - - numlim = 0.01; - xsi = 3.; - ea = G4Exp(-xsi); - eaa = 1. - ea; - - skindepth = skin * stepmin; - - mass = proton_mass_c2; - charge = ChargeSquare = 1.0; - currentKinEnergy = currentRadLength = lambda0 = lambdaeff = tPathLength = zPathLength = par1 = par2 = par3 = 0; - - currentMaterialIndex = -1; - fParticleChange = nullptr; - couple = nullptr; - SetSampleZ(false); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -UrbanMscModel93::~UrbanMscModel93() {} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -void UrbanMscModel93::Initialise(const G4ParticleDefinition* p, const G4DataVector&) { - skindepth = skin * stepmin; - - // set values of some data members - SetParticle(p); - - if (p->GetPDGMass() > MeV) { - G4cout << "### WARNING: UrbanMscModel93 model is used for " << p->GetParticleName() << " !!! " << G4endl; - G4cout << "### This model should be used only for e+-" << G4endl; - } - - fParticleChange = GetParticleChangeForMSC(p); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -G4double UrbanMscModel93::ComputeCrossSectionPerAtom( - const G4ParticleDefinition* part, G4double KineticEnergy, G4double AtomicNumber, G4double, G4double, G4double) { - static const G4double sigmafactor = twopi * classic_electr_radius * classic_electr_radius; - static const G4double epsfactor = - 2. * electron_mass_c2 * electron_mass_c2 * Bohr_radius * Bohr_radius / (hbarc * hbarc); - static const G4double epsmin = 1.e-4, epsmax = 1.e10; - - static const G4double Zdat[15] = {4., 6., 13., 20., 26., 29., 32., 38., 47., 50., 56., 64., 74., 79., 82.}; - - static const G4double Tdat[22] = {100 * eV, 200 * eV, 400 * eV, 700 * eV, 1 * keV, 2 * keV, 4 * keV, 7 * keV, - 10 * keV, 20 * keV, 40 * keV, 70 * keV, 100 * keV, 200 * keV, 400 * keV, 700 * keV, - 1 * MeV, 2 * MeV, 4 * MeV, 7 * MeV, 10 * MeV, 20 * MeV}; - - // corr. factors for e-/e+ lambda for T <= Tlim - static const G4double celectron[15][22] = { - {1.125, 1.072, 1.051, 1.047, 1.047, 1.050, 1.052, 1.054, 1.054, 1.057, 1.062, - 1.069, 1.075, 1.090, 1.105, 1.111, 1.112, 1.108, 1.100, 1.093, 1.089, 1.087}, - {1.408, 1.246, 1.143, 1.096, 1.077, 1.059, 1.053, 1.051, 1.052, 1.053, 1.058, - 1.065, 1.072, 1.087, 1.101, 1.108, 1.109, 1.105, 1.097, 1.090, 1.086, 1.082}, - {2.833, 2.268, 1.861, 1.612, 1.486, 1.309, 1.204, 1.156, 1.136, 1.114, 1.106, - 1.106, 1.109, 1.119, 1.129, 1.132, 1.131, 1.124, 1.113, 1.104, 1.099, 1.098}, - {3.879, 3.016, 2.380, 2.007, 1.818, 1.535, 1.340, 1.236, 1.190, 1.133, 1.107, - 1.099, 1.098, 1.103, 1.110, 1.113, 1.112, 1.105, 1.096, 1.089, 1.085, 1.098}, - {6.937, 4.330, 2.886, 2.256, 1.987, 1.628, 1.395, 1.265, 1.203, 1.122, 1.080, - 1.065, 1.061, 1.063, 1.070, 1.073, 1.073, 1.070, 1.064, 1.059, 1.056, 1.056}, - {9.616, 5.708, 3.424, 2.551, 2.204, 1.762, 1.485, 1.330, 1.256, 1.155, 1.099, - 1.077, 1.070, 1.068, 1.072, 1.074, 1.074, 1.070, 1.063, 1.059, 1.056, 1.052}, - {11.72, 6.364, 3.811, 2.806, 2.401, 1.884, 1.564, 1.386, 1.300, 1.180, 1.112, - 1.082, 1.073, 1.066, 1.068, 1.069, 1.068, 1.064, 1.059, 1.054, 1.051, 1.050}, - {18.08, 8.601, 4.569, 3.183, 2.662, 2.025, 1.646, 1.439, 1.339, 1.195, 1.108, - 1.068, 1.053, 1.040, 1.039, 1.039, 1.039, 1.037, 1.034, 1.031, 1.030, 1.036}, - {18.22, 10.48, 5.333, 3.713, 3.115, 2.367, 1.898, 1.631, 1.498, 1.301, 1.171, - 1.105, 1.077, 1.048, 1.036, 1.033, 1.031, 1.028, 1.024, 1.022, 1.021, 1.024}, - {14.14, 10.65, 5.710, 3.929, 3.266, 2.453, 1.951, 1.669, 1.528, 1.319, 1.178, - 1.106, 1.075, 1.040, 1.027, 1.022, 1.020, 1.017, 1.015, 1.013, 1.013, 1.020}, - {14.11, 11.73, 6.312, 4.240, 3.478, 2.566, 2.022, 1.720, 1.569, 1.342, 1.186, - 1.102, 1.065, 1.022, 1.003, 0.997, 0.995, 0.993, 0.993, 0.993, 0.993, 1.011}, - {22.76, 20.01, 8.835, 5.287, 4.144, 2.901, 2.219, 1.855, 1.677, 1.410, 1.224, - 1.121, 1.073, 1.014, 0.986, 0.976, 0.974, 0.972, 0.973, 0.974, 0.975, 0.987}, - {50.77, 40.85, 14.13, 7.184, 5.284, 3.435, 2.520, 2.059, 1.837, 1.512, 1.283, - 1.153, 1.091, 1.010, 0.969, 0.954, 0.950, 0.947, 0.949, 0.952, 0.954, 0.963}, - {65.87, 59.06, 15.87, 7.570, 5.567, 3.650, 2.682, 2.182, 1.939, 1.579, 1.325, - 1.178, 1.108, 1.014, 0.965, 0.947, 0.941, 0.938, 0.940, 0.944, 0.946, 0.954}, - {55.60, 47.34, 15.92, 7.810, 5.755, 3.767, 2.760, 2.239, 1.985, 1.609, 1.343, - 1.188, 1.113, 1.013, 0.960, 0.939, 0.933, 0.930, 0.933, 0.936, 0.939, 0.949}}; - - static const G4double cpositron[15][22] = { - {2.589, 2.044, 1.658, 1.446, 1.347, 1.217, 1.144, 1.110, 1.097, 1.083, 1.080, - 1.086, 1.092, 1.108, 1.123, 1.131, 1.131, 1.126, 1.117, 1.108, 1.103, 1.100}, - {3.904, 2.794, 2.079, 1.710, 1.543, 1.325, 1.202, 1.145, 1.122, 1.096, 1.089, - 1.092, 1.098, 1.114, 1.130, 1.137, 1.138, 1.132, 1.122, 1.113, 1.108, 1.102}, - {7.970, 6.080, 4.442, 3.398, 2.872, 2.127, 1.672, 1.451, 1.357, 1.246, 1.194, - 1.179, 1.178, 1.188, 1.201, 1.205, 1.203, 1.190, 1.173, 1.159, 1.151, 1.145}, - {9.714, 7.607, 5.747, 4.493, 3.815, 2.777, 2.079, 1.715, 1.553, 1.353, 1.253, - 1.219, 1.211, 1.214, 1.225, 1.228, 1.225, 1.210, 1.191, 1.175, 1.166, 1.174}, - {17.97, 12.95, 8.628, 6.065, 4.849, 3.222, 2.275, 1.820, 1.624, 1.382, 1.259, - 1.214, 1.202, 1.202, 1.214, 1.219, 1.217, 1.203, 1.184, 1.169, 1.160, 1.151}, - {24.83, 17.06, 10.84, 7.355, 5.767, 3.707, 2.546, 1.996, 1.759, 1.465, 1.311, - 1.252, 1.234, 1.228, 1.238, 1.241, 1.237, 1.222, 1.201, 1.184, 1.174, 1.159}, - {23.26, 17.15, 11.52, 8.049, 6.375, 4.114, 2.792, 2.155, 1.880, 1.535, 1.353, - 1.281, 1.258, 1.247, 1.254, 1.256, 1.252, 1.234, 1.212, 1.194, 1.183, 1.170}, - {22.33, 18.01, 12.86, 9.212, 7.336, 4.702, 3.117, 2.348, 2.015, 1.602, 1.385, - 1.297, 1.268, 1.251, 1.256, 1.258, 1.254, 1.237, 1.214, 1.195, 1.185, 1.179}, - {33.91, 24.13, 15.71, 10.80, 8.507, 5.467, 3.692, 2.808, 2.407, 1.873, 1.564, - 1.425, 1.374, 1.330, 1.324, 1.320, 1.312, 1.288, 1.258, 1.235, 1.221, 1.205}, - {32.14, 24.11, 16.30, 11.40, 9.015, 5.782, 3.868, 2.917, 2.490, 1.925, 1.596, - 1.447, 1.391, 1.342, 1.332, 1.327, 1.320, 1.294, 1.264, 1.240, 1.226, 1.214}, - {29.51, 24.07, 17.19, 12.28, 9.766, 6.238, 4.112, 3.066, 2.602, 1.995, 1.641, - 1.477, 1.414, 1.356, 1.342, 1.336, 1.328, 1.302, 1.270, 1.245, 1.231, 1.233}, - {38.19, 30.85, 21.76, 15.35, 12.07, 7.521, 4.812, 3.498, 2.926, 2.188, 1.763, - 1.563, 1.484, 1.405, 1.382, 1.371, 1.361, 1.330, 1.294, 1.267, 1.251, 1.239}, - {49.71, 39.80, 27.96, 19.63, 15.36, 9.407, 5.863, 4.155, 3.417, 2.478, 1.944, - 1.692, 1.589, 1.480, 1.441, 1.423, 1.409, 1.372, 1.330, 1.298, 1.280, 1.258}, - {59.25, 45.08, 30.36, 20.83, 16.15, 9.834, 6.166, 4.407, 3.641, 2.648, 2.064, - 1.779, 1.661, 1.531, 1.482, 1.459, 1.442, 1.400, 1.354, 1.319, 1.299, 1.272}, - {56.38, 44.29, 30.50, 21.18, 16.51, 10.11, 6.354, 4.542, 3.752, 2.724, 2.116, - 1.817, 1.692, 1.554, 1.499, 1.474, 1.456, 1.412, 1.364, 1.328, 1.307, 1.282}}; - - //data/corrections for T > Tlim - static const G4double Tlim = 10. * MeV; - static const G4double beta2lim = - Tlim * (Tlim + 2. * electron_mass_c2) / ((Tlim + electron_mass_c2) * (Tlim + electron_mass_c2)); - static const G4double bg2lim = Tlim * (Tlim + 2. * electron_mass_c2) / (electron_mass_c2 * electron_mass_c2); - - static const G4double sig0[15] = {0.2672 * barn, - 0.5922 * barn, - 2.653 * barn, - 6.235 * barn, - 11.69 * barn, - 13.24 * barn, - 16.12 * barn, - 23.00 * barn, - 35.13 * barn, - 39.95 * barn, - 50.85 * barn, - 67.19 * barn, - 91.15 * barn, - 104.4 * barn, - 113.1 * barn}; - - static const G4double hecorr[15] = { - 120.70, 117.50, 105.00, 92.92, 79.23, 74.510, 68.29, 57.39, 41.97, 36.14, 24.53, 10.21, -7.855, -16.84, -22.30}; - - G4double sigma; - SetParticle(part); - - Z23 = pow(AtomicNumber, 2. / 3.); - - // correction if particle .ne. e-/e+ - // compute equivalent kinetic energy - // lambda depends on p*beta .... - - G4double eKineticEnergy = KineticEnergy; - - if (mass > electron_mass_c2) { - G4double TAU = KineticEnergy / mass; - G4double c = mass * TAU * (TAU + 2.) / (electron_mass_c2 * (TAU + 1.)); - G4double w = c - 2.; - G4double tau = 0.5 * (w + sqrt(w * w + 4. * c)); - eKineticEnergy = electron_mass_c2 * tau; - } - - G4double eTotalEnergy = eKineticEnergy + electron_mass_c2; - G4double beta2 = eKineticEnergy * (eTotalEnergy + electron_mass_c2) / (eTotalEnergy * eTotalEnergy); - G4double bg2 = eKineticEnergy * (eTotalEnergy + electron_mass_c2) / (electron_mass_c2 * electron_mass_c2); - - G4double eps = epsfactor * bg2 / Z23; - - if (eps < epsmin) - sigma = 2. * eps * eps; - else if (eps < epsmax) - sigma = G4Log(1. + 2. * eps) - 2. * eps / (1. + 2. * eps); - else - sigma = G4Log(2. * eps) - 1. + 1. / eps; - - sigma *= ChargeSquare * AtomicNumber * AtomicNumber / (beta2 * bg2); - - // interpolate in AtomicNumber and beta2 - G4double c1, c2, cc1, cc2, corr; - - // get bin number in Z - G4int iZ = 14; - while ((iZ >= 0) && (Zdat[iZ] >= AtomicNumber)) - iZ -= 1; - if (iZ == 14) - iZ = 13; - if (iZ == -1) - iZ = 0; - - G4double ZZ1 = Zdat[iZ]; - G4double ZZ2 = Zdat[iZ + 1]; - G4double ratZ = (AtomicNumber - ZZ1) * (AtomicNumber + ZZ1) / ((ZZ2 - ZZ1) * (ZZ2 + ZZ1)); - - if (eKineticEnergy <= Tlim) { - // get bin number in T (beta2) - G4int iT = 21; - while ((iT >= 0) && (Tdat[iT] >= eKineticEnergy)) - iT -= 1; - if (iT == 21) - iT = 20; - if (iT == -1) - iT = 0; - - // calculate betasquare values - G4double T = Tdat[iT], E = T + electron_mass_c2; - G4double b2small = T * (E + electron_mass_c2) / (E * E); - - T = Tdat[iT + 1]; - E = T + electron_mass_c2; - G4double b2big = T * (E + electron_mass_c2) / (E * E); - G4double ratb2 = (beta2 - b2small) / (b2big - b2small); - - if (charge < 0.) { - c1 = celectron[iZ][iT]; - c2 = celectron[iZ + 1][iT]; - cc1 = c1 + ratZ * (c2 - c1); - - c1 = celectron[iZ][iT + 1]; - c2 = celectron[iZ + 1][iT + 1]; - cc2 = c1 + ratZ * (c2 - c1); - - corr = cc1 + ratb2 * (cc2 - cc1); - - sigma *= sigmafactor / corr; - } else { - c1 = cpositron[iZ][iT]; - c2 = cpositron[iZ + 1][iT]; - cc1 = c1 + ratZ * (c2 - c1); - - c1 = cpositron[iZ][iT + 1]; - c2 = cpositron[iZ + 1][iT + 1]; - cc2 = c1 + ratZ * (c2 - c1); - - corr = cc1 + ratb2 * (cc2 - cc1); - - sigma *= sigmafactor / corr; - } - } else { - c1 = bg2lim * sig0[iZ] * (1. + hecorr[iZ] * (beta2 - beta2lim)) / bg2; - c2 = bg2lim * sig0[iZ + 1] * (1. + hecorr[iZ + 1] * (beta2 - beta2lim)) / bg2; - if ((AtomicNumber >= ZZ1) && (AtomicNumber <= ZZ2)) - sigma = c1 + ratZ * (c2 - c1); - else if (AtomicNumber < ZZ1) - sigma = AtomicNumber * AtomicNumber * c1 / (ZZ1 * ZZ1); - else if (AtomicNumber > ZZ2) - sigma = AtomicNumber * AtomicNumber * c2 / (ZZ2 * ZZ2); - } - return sigma; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -void UrbanMscModel93::StartTracking(G4Track* track) { - SetParticle(track->GetDynamicParticle()->GetDefinition()); - firstStep = true; - inside = false; - insideskin = false; - tlimit = geombig; - stepmin = tlimitminfix; - tlimitmin = 10. * stepmin; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -G4double UrbanMscModel93::ComputeTruePathLengthLimit(const G4Track& track, G4double& currentMinimalStep) { - tPathLength = currentMinimalStep; - const G4DynamicParticle* dp = track.GetDynamicParticle(); - G4StepPoint* sp = track.GetStep()->GetPreStepPoint(); - G4StepStatus stepStatus = sp->GetStepStatus(); - couple = track.GetMaterialCutsCouple(); - SetCurrentCouple(couple); - currentMaterialIndex = couple->GetIndex(); - currentKinEnergy = dp->GetKineticEnergy(); - currentRange = GetRange(particle, currentKinEnergy, couple); - lambda0 = GetTransportMeanFreePath(particle, currentKinEnergy); - - // stop here if small range particle - if (inside || tPathLength < tlimitminfix) { - return ConvertTrueToGeom(tPathLength, currentMinimalStep); - } - - if (tPathLength > currentRange) { - tPathLength = currentRange; - } - - presafety = sp->GetSafety(); - - // G4cout << "Urban2::StepLimit tPathLength= " - // <GetMaterial()->GetName() - << " CosTheta= " << cth - << " is too big"; - G4Exception("UrbanMscModel93::SampleScattering","em0004", - JustWarning, ed,""); - } - */ - - G4double sth = sqrt((1.0 - cth) * (1.0 + cth)); - G4double phi = twopi * G4UniformRand(); - G4double dirx = sth * cos(phi); - G4double diry = sth * sin(phi); - - G4ThreeVector newDirection(dirx, diry, cth); - newDirection.rotateUz(oldDirection); - fParticleChange->ProposeMomentumDirection(newDirection); - - if (latDisplasment && safety > tlimitminfix) { - G4double r = SampleDisplacement(); - /* - G4cout << "UrbanMscModel93::SampleSecondaries: e(MeV)= " << kineticEnergy - << " sinTheta= " << sth << " r(mm)= " << r - << " trueStep(mm)= " << tPathLength - << " geomStep(mm)= " << zPathLength - << G4endl; - */ - if (r > 0.) { - G4double latcorr = LatCorrelation(); - if (latcorr > r) - latcorr = r; - - // sample direction of lateral displacement - // compute it from the lateral correlation - G4double Phi = 0.; - if (std::abs(r * sth) < latcorr) - Phi = twopi * G4UniformRand(); - else { - G4double psi = std::acos(latcorr / (r * sth)); - if (G4UniformRand() < 0.5) - Phi = phi + psi; - else - Phi = phi - psi; - } - - dirx = r * std::cos(Phi); - diry = r * std::sin(Phi); - - fDisplacement.set(dirx, diry, 0.0); - fDisplacement.rotateUz(oldDirection); - } - } - return fDisplacement; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -G4double UrbanMscModel93::SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy) { - G4double cth = 1.; - G4double tau = trueStepLength / lambda0; - - Zeff = couple->GetMaterial()->GetTotNbOfElectPerVolume() / couple->GetMaterial()->GetTotNbOfAtomsPerVolume(); - - if (Zold != Zeff) - UpdateCache(); - - if (insideskin) { - //no scattering, single or plural scattering - G4double mean = trueStepLength / stepmin; - - G4int n = G4Poisson(mean); - if (n > 0) { - //screening (Moliere-Bethe) - G4double mom2 = KineticEnergy * (2. * mass + KineticEnergy); - G4double beta2 = mom2 / ((KineticEnergy + mass) * (KineticEnergy + mass)); - G4double ascr = scr1 / mom2; - ascr *= 1.13 + scr2 / beta2; - G4double ascr1 = 1. + 2. * ascr; - G4double bp1 = ascr1 + 1.; - G4double bm1 = ascr1 - 1.; - - // single scattering from screened Rutherford x-section - G4double ct, st, phi; - G4double sx = 0., sy = 0., sz = 0.; - for (G4int i = 1; i <= n; i++) { - ct = ascr1 - bp1 * bm1 / (2. * G4UniformRand() + bm1); - if (ct < -1.) - ct = -1.; - if (ct > 1.) - ct = 1.; - st = sqrt(1. - ct * ct); - phi = twopi * G4UniformRand(); - sx += st * cos(phi); - sy += st * sin(phi); - sz += ct; - } - cth = sz / sqrt(sx * sx + sy * sy + sz * sz); - } - } else { - if (trueStepLength >= currentRange * dtrl) { - if (par1 * trueStepLength < 1.) - tau = -par2 * G4Log(1. - par1 * trueStepLength); - // for the case if ioni/brems are inactivated - // see the corresponding condition in ComputeGeomPathLength - else if (1. - KineticEnergy / currentKinEnergy > taulim) - tau = taubig; - } - currentTau = tau; - lambdaeff = trueStepLength / currentTau; - currentRadLength = couple->GetMaterial()->GetRadlen(); - - if (tau >= taubig) - cth = -1. + 2. * G4UniformRand(); - else if (tau >= tausmall) { - G4double xmeanth, x2meanth; - if (tau < numlim) { - xmeanth = 1.0 - tau * (1.0 - 0.5 * tau); - x2meanth = 1.0 - tau * (5.0 - 6.25 * tau) * third; - } else { - xmeanth = G4Exp(-tau); - x2meanth = (1. + 2. * G4Exp(-2.5 * tau)) * third; - } - G4double relloss = 1. - KineticEnergy / currentKinEnergy; - - if (relloss > rellossmax) - return SimpleScattering(xmeanth, x2meanth); - - G4double theta0 = ComputeTheta0(trueStepLength, KineticEnergy); - - //G4cout << "Theta0= " << theta0 << " theta0max= " << theta0max - // << " sqrt(tausmall)= " << sqrt(tausmall) << G4endl; - - // protection for very small angles - G4double theta2 = theta0 * theta0; - - if (theta2 < tausmall) { - return cth; - } - - if (theta0 > theta0max) { - return SimpleScattering(xmeanth, x2meanth); - } - - G4double x = theta2 * (1.0 - theta2 / 12.); - if (theta2 > numlim) { - G4double sth = 2. * sin(0.5 * theta0); - x = sth * sth; - } - - G4double xmean1 = 1. - (1. - (1. + xsi) * ea) * x / eaa; - G4double x0 = 1. - xsi * x; - - // G4cout << " xmean1= " << xmean1 << " xmeanth= " << xmeanth << G4endl; - - if (xmean1 <= 0.999 * xmeanth) { - return SimpleScattering(xmeanth, x2meanth); - } - // from e- and muon scattering data - G4double c = coeffc1 + coeffc2 * y; - - // tail should not be too big - if (c < 1.9) { - /* - if(KineticEnergy > 200*MeV && c < 1.6) { - G4cout << "UrbanMscModel93::SampleCosineTheta: E(GeV)= " - << KineticEnergy/GeV - << " !!** c= " << c - << " **!! length(mm)= " << trueStepLength << " Zeff= " << Zeff - << " " << couple->GetMaterial()->GetName() - << " tau= " << tau << G4endl; - } - */ - c = 1.9; - } - - if (fabs(c - 3.) < 0.001) { - c = 3.001; - } else if (fabs(c - 2.) < 0.001) { - c = 2.001; - } - - G4double c1 = c - 1.; - - //from continuity of derivatives - G4double b = 1. + (c - xsi) * x; - - G4double b1 = b + 1.; - G4double bx = c * x; - - G4double eb1 = pow(b1, c1); - G4double ebx = pow(bx, c1); - G4double d = ebx / eb1; - - // G4double xmean2 = (x0*eb1+ebx-(eb1*bx-b1*ebx)/(c-2.))/(eb1-ebx); - G4double xmean2 = (x0 + d - (bx - b1 * d) / (c - 2.)) / (1. - d); - - G4double f1x0 = ea / eaa; - G4double f2x0 = c1 / (c * (1. - d)); - G4double prob = f2x0 / (f1x0 + f2x0); - - G4double qprob = xmeanth / (prob * xmean1 + (1. - prob) * xmean2); - - // sampling of costheta - //G4cout << "c= " << c << " qprob= " << qprob << " eb1= " << eb1 - // << " c1= " << c1 << " b1= " << b1 << " bx= " << bx << " eb1= " << eb1 - // << G4endl; - if (G4UniformRand() < qprob) { - G4double var = 0; - if (G4UniformRand() < prob) { - cth = 1. + G4Log(ea + G4UniformRand() * eaa) * x; - } else { - var = (1.0 - d) * G4UniformRand(); - if (var < numlim * d) { - var /= (d * c1); - cth = -1.0 + var * (1.0 - 0.5 * var * c) * (2. + (c - xsi) * x); - } else { - cth = 1. + x * (c - xsi - c * pow(var + d, -1.0 / c1)); - //b-b1*bx/G4Exp(log(ebx+(eb1-ebx)*G4UniformRand())/c1) ; - } - } - if (KineticEnergy > 5 * GeV && cth < 0.9) { - G4cout << "UrbanMscModel93::SampleCosineTheta: E(GeV)= " << KineticEnergy / GeV << " 1-cosT= " << 1 - cth - << " length(mm)= " << trueStepLength << " Zeff= " << Zeff << " tau= " << tau << " prob= " << prob - << " var= " << var << G4endl; - G4cout << " c= " << c << " qprob= " << qprob << " eb1= " << eb1 << " ebx= " << ebx << " c1= " << c1 - << " b= " << b << " b1= " << b1 << " bx= " << bx << " d= " << d << " ea= " << ea << " eaa= " << eaa - << G4endl; - } - } else { - cth = -1. + 2. * G4UniformRand(); - if (KineticEnergy > 5 * GeV) { - G4cout << "UrbanMscModel93::SampleCosineTheta: E(GeV)= " << KineticEnergy / GeV - << " length(mm)= " << trueStepLength << " Zeff= " << Zeff << " qprob= " << qprob << G4endl; - } - } - } - } - return cth; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -G4double UrbanMscModel93::SampleDisplacement() { - // Compute rmean = sqrt() from theory - G4double rmean = 0.0; - if ((currentTau >= tausmall) && !insideskin) { - if (currentTau < taulim) { - rmean = kappa * currentTau * currentTau * currentTau * (1. - kappapl1 * currentTau * 0.25) / 6.; - - } else { - G4double etau = 0.0; - if (currentTau < taubig) - etau = G4Exp(-currentTau); - rmean = -kappa * currentTau; - rmean = -G4Exp(rmean) / (kappa * kappami1); - rmean += currentTau - kappapl1 / kappa + kappa * etau / kappami1; - } - if (rmean > 0.) - rmean = 2. * lambdaeff * sqrt(rmean * third); - else - rmean = 0.; - } - - if (rmean == 0.) - return rmean; - - // protection against z > t ........................... - G4double rmax = (tPathLength - zPathLength) * (tPathLength + zPathLength); - if (rmax <= 0.) - rmax = 0.; - else - rmax = sqrt(rmax); - - if (rmean >= rmax) - return rmax; - - return rmean; - // VI comment out for the time being - /* - //sample r (Gaussian distribution with a mean of rmean ) - G4double r = 0.; - G4double sigma = min(rmean,rmax-rmean); - sigma /= 3.; - G4double rlow = rmean-3.*sigma; - G4double rhigh = rmean+3.*sigma; - do { - r = G4RandGauss::shoot(rmean,sigma); - } while ((r < rlow) || (r > rhigh)); - - return r; - */ -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -G4double UrbanMscModel93::LatCorrelation() { - G4double latcorr = 0.; - if ((currentTau >= tausmall) && !insideskin) { - if (currentTau < taulim) - latcorr = lambdaeff * kappa * currentTau * currentTau * (1. - kappapl1 * currentTau * third) * third; - else { - G4double etau = 0.; - if (currentTau < taubig) - etau = G4Exp(-currentTau); - latcorr = -kappa * currentTau; - latcorr = G4Exp(latcorr) / kappami1; - latcorr += 1. - kappa * etau / kappami1; - latcorr *= 2. * lambdaeff * third; - } - } - - return latcorr; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h index 769c384d34321..1ac319ebb449a 100644 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h +++ b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h @@ -55,6 +55,7 @@ class PrintGeomInfoAction : public SimWatcher, public Observer names_; G4VPhysicalVolume* theTopPV_; G4NavigationHistory fHistory_; diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc index cd93c2609d491..f428d816dc131 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc @@ -62,6 +62,7 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { fileLV_ = p.getUntrackedParameter("LVFileName", ""); filePV_ = p.getUntrackedParameter("PVFileName", ""); fileTouch_ = p.getUntrackedParameter("TouchFileName", ""); + fileDetail_ = p.getUntrackedParameter("FileDetail", false); G4cout << "PrintGeomInfoAction:: initialised for dd4hep " << dd4hep_ << " with verbosity levels:" << " Summary " << dumpSummary_ << " LVTree " << dumpLVTree_ << " LVList " << dumpLVList_ << " Material " << dumpMaterial_ << "\n " @@ -72,8 +73,8 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ << "\n " << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" << fileLV_ << ":" - << filePV_ << ":" << fileTouch_ << "\n " - << "for " << names_.size() << " names:"; + << filePV_ << ":" << fileTouch_ << " FileDetail " << fileDetail_ + << "\n for " << names_.size() << " names:"; for (unsigned int i = 0; i < names_.size(); i++) G4cout << " " << names_[i]; G4cout << G4endl; @@ -432,31 +433,51 @@ void PrintGeomInfoAction::dumpInFile() { if (!fileMat_.empty()) { const G4MaterialTable *matTab = G4Material::GetMaterialTable(); std::ofstream fout(fileMat_.c_str()); - for (std::vector::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++) - fout << (*matite)->GetName() << "\n"; + for (std::vector::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++) { + if (!fileDetail_) + fout << (*matite)->GetName() << "\n"; + else + fout << (*matite)->GetName() << " " << (*matite)->GetRadlen() << " " << (*matite)->GetNuclearInterLength() + << "\n"; + } fout.close(); } const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance(); if (!fileSolid_.empty()) { std::ofstream fout(fileSolid_.c_str()); for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) - fout << (*lvcite)->GetSolid()->GetName() << "\n"; + if (!fileDetail_) + fout << (*lvcite)->GetSolid()->GetName() << "\n"; + else + fout << (*lvcite)->GetSolid()->GetName() << " " << (*lvcite)->GetSolid()->GetCubicVolume() << "\n"; fout.close(); } if (!fileLV_.empty()) { std::ofstream fout(fileLV_.c_str()); for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) - fout << (*lvcite)->GetName() << "\n"; + if (!fileDetail_) + fout << (*lvcite)->GetName() << "\n"; + else + fout << (*lvcite)->GetName() << " " << (*lvcite)->GetMass(false, false) << "\n"; fout.close(); } if (!filePV_.empty()) { const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance(); std::ofstream fout(filePV_.c_str()); for (std::vector::const_iterator pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) { - if (dd4hep_) - fout << (*pvcite)->GetName() << "\n"; - else - fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << "\n"; + if (fileDetail_) { + if (dd4hep_) + fout << (*pvcite)->GetName() << " " << (*pvcite)->GetTranslation().x() << " " + << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << "\n"; + else + fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << " " << (*pvcite)->GetTranslation().x() + << " " << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << "\n"; + } else { + if (dd4hep_) + fout << (*pvcite)->GetName() << "\n"; + else + fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << "\n"; + } } fout.close(); } diff --git a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp index ded68bfdce1a7..5949933d170e1 100644 --- a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp +++ b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp @@ -6,6 +6,8 @@ // SimFileCompare infile1 infile2 mode debug // infile1 (const char*) File created using DDD // infile2 (const char*) File created using DD4Hep +// type (int) Type of file: material (0), solid (1), +// LogicalVolume (2), PhysicalVolume (3) // mode (int) Treat (0) or not treat (1) names from DDD // deug (int) Single digit number (0 minimum printout) // @@ -20,6 +22,30 @@ #include #include +struct materials { + int occ; + double radl, intl; + materials(int oc = 1, double rd = 0, double in = 0) : occ(oc), radl(rd), intl(in) {} +}; + +struct solids { + int occ; + double volume; + solids(int oc = 1, double vol = 0) : occ(oc), volume(vol) {} +}; + +struct lvs { + int occ; + double mass; + lvs(int oc = 1, double m = 0) : occ(oc), mass(m) {} +}; + +struct pvs { + int occ; + double xx, yy, zz; + pvs(int oc = 1, double x = 0, double y = 0, double z = 0) : occ(oc), xx(x), yy(y), zz(z) {} +}; + std::string removeExtraName(const std::string& name, int debug) { std::string nam(name); std::string nam1 = name.substr(0, 2); @@ -61,68 +87,261 @@ std::string reducedName(const std::string& name, int debug) { return nam; } -void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int mode, int debug) { - std::map nameDDD, nameDD4Hep; +std::vector splitString(const std::string& fLine) { + std::vector result; + int start = 0; + bool empty = true; + for (unsigned i = 0; i <= fLine.size(); i++) { + if (fLine[i] == ' ' || i == fLine.size()) { + if (!empty) { + std::string item(fLine, start, i - start); + result.push_back(item); + empty = true; + } + start = i + 1; + } else { + if (empty) + empty = false; + } + } + return result; +} + +template +void myPrint1(std::map const& obj) { + for (auto it : obj) { + if (it.second.occ > 1) + std::cout << it.first << " : " << it.second.occ << std::endl; + } +} + +template +void myPrint2(std::map const& obj1, std::map const& obj2) { + for (auto it : obj1) { + if (obj2.find(it.first) == obj2.end()) + std::cout << it.first << " appearing " << it.second.occ << " times" << std::endl; + } +} + +void CompareFiles(const char* fileDDD, const char* fileDD4Hep, int type, int mode, int debug) { + std::map matDDD, matDD4Hep; + std::map solidDDD, solidDD4Hep; + std::map lvDDD, lvDD4Hep; + std::map pvDDD, pvDD4Hep; char buffer[100]; std::string name; std::ifstream fInput1(fileDDD); + unsigned int sizeDDD(0), sizeDD4Hep(0); if (!fInput1.good()) { std::cout << "Cannot open file " << fileDDD << std::endl; } else { while (fInput1.getline(buffer, 100)) { - name = ((mode == 1) ? removeExtraName(std::string(buffer), debug) : std::string(buffer)); - auto it = nameDDD.find(name); - if (it == nameDDD.end()) - nameDDD[name] = 1; - else - ++(it->second); + std::vector items = splitString(std::string(buffer)); + name = ((mode == 1) ? removeExtraName(items[0], debug) : items[0]); + double r1 = (items.size() > 1) ? atof(items[1].c_str()) : 0; + double r2 = (items.size() > 2) ? atof(items[2].c_str()) : 0; + double r3 = (items.size() > 3) ? atof(items[3].c_str()) : 0; + if (type == 0) { + auto it = matDDD.find(name); + if (it == matDDD.end()) + matDDD[name] = materials(1, r1, r2); + else + ++((it->second).occ); + } else if (type == 1) { + auto it = solidDDD.find(name); + if (it == solidDDD.end()) + solidDDD[name] = solids(1, r1); + else + ++((it->second).occ); + } else if (type == 2) { + auto it = lvDDD.find(name); + if (it == lvDDD.end()) + lvDDD[name] = lvs(1, r1); + else + ++((it->second).occ); + } else { + auto it = pvDDD.find(name); + if (it == pvDDD.end()) + pvDDD[name] = pvs(1, r1, r2, r3); + else + ++((it->second).occ); + } } fInput1.close(); + sizeDDD = + ((type == 0) ? matDDD.size() : ((type == 1) ? solidDDD.size() : ((type == 2) ? lvDDD.size() : pvDDD.size()))); } std::ifstream fInput2(fileDD4Hep); if (!fInput2.good()) { std::cout << "Cannot open file " << fileDD4Hep << std::endl; } else { while (fInput2.getline(buffer, 100)) { - name = reducedName(std::string(buffer), debug); - auto it = nameDD4Hep.find(name); - if (it == nameDD4Hep.end()) - nameDD4Hep[name] = 1; - else - ++(it->second); + std::vector items = splitString(std::string(buffer)); + name = reducedName(items[0], debug); + double r1 = (items.size() > 1) ? atof(items[1].c_str()) : 0; + double r2 = (items.size() > 2) ? atof(items[2].c_str()) : 0; + double r3 = (items.size() > 3) ? atof(items[3].c_str()) : 0; + if (type == 0) { + auto it = matDD4Hep.find(name); + if (it == matDD4Hep.end()) + matDD4Hep[name] = materials(1, r1, r2); + else + ++((it->second).occ); + } else if (type == 1) { + auto it = solidDD4Hep.find(name); + if (it == solidDD4Hep.end()) + solidDD4Hep[name] = solids(1, r1); + else + ++((it->second).occ); + } else if (type == 2) { + auto it = lvDD4Hep.find(name); + if (it == lvDD4Hep.end()) + lvDD4Hep[name] = lvs(1, r1); + else + ++((it->second).occ); + } else { + auto it = pvDD4Hep.find(name); + if (it == pvDD4Hep.end()) + pvDD4Hep[name] = pvs(1, r1, r2, r3); + else + ++((it->second).occ); + } } - fInput1.close(); + fInput2.close(); + sizeDD4Hep = ((type == 0) ? matDD4Hep.size() + : ((type == 1) ? solidDD4Hep.size() : ((type == 2) ? lvDD4Hep.size() : pvDD4Hep.size()))); } - std::cout << "Reads " << nameDDD.size() << " names from " << fileDDD << " and " << nameDD4Hep.size() << " names from " - << fileDD4Hep << std::endl; + std::cout << "Reads " << sizeDDD << " names from " << fileDDD << " and " << sizeDD4Hep << " names from " << fileDD4Hep + << std::endl; std::cout << "\nMore than one entry for a given name in " << fileDDD << std::endl; - for (auto it : nameDDD) { - if (it.second > 1) - std::cout << it.first << " : " << it.second << std::endl; + if (type == 0) { + myPrint1(matDDD); + } else if (type == 1) { + myPrint1(solidDDD); + } else if (type == 2) { + myPrint1(lvDDD); + } else { + myPrint1(pvDDD); } + std::cout << "\nMore than one entry for a given name in " << fileDD4Hep << std::endl; - for (auto it : nameDD4Hep) { - if (it.second > 1) - std::cout << it.first << " : " << it.second << std::endl; + if (type == 0) { + myPrint1(matDD4Hep); + } else if (type == 1) { + myPrint1(solidDD4Hep); + } else if (type == 2) { + myPrint1(lvDD4Hep); + } else { + myPrint1(pvDD4Hep); } + std::cout << "\nEntry in " << fileDDD << " not in " << fileDD4Hep << std::endl; - for (auto it : nameDDD) { - if (nameDD4Hep.find(it.first) == nameDD4Hep.end()) - std::cout << it.first << " appearing " << it.second << " times" << std::endl; + if (type == 0) { + myPrint2(matDDD, matDD4Hep); + } else if (type == 1) { + myPrint2(solidDDD, solidDD4Hep); + } else if (type == 2) { + myPrint2(lvDDD, lvDD4Hep); + } else { + myPrint2(pvDDD, pvDD4Hep); } + std::cout << "\nEntry in " << fileDD4Hep << " not in " << fileDDD << std::endl; - for (auto it : nameDD4Hep) { - if (nameDDD.find(it.first) == nameDDD.end()) - std::cout << it.first << " appearing " << it.second << " times" << std::endl; + if (type == 0) { + myPrint2(matDD4Hep, matDDD); + } else if (type == 1) { + myPrint2(solidDD4Hep, solidDDD); + } else if (type == 2) { + myPrint2(lvDD4Hep, lvDDD); + } else { + myPrint2(pvDD4Hep, pvDDD); + } + + //Now type specific changes + std::cout << "\nEntries in " << fileDDD << " and " << fileDD4Hep << " do not match in the content\n"; + const double denmin = 0.0001; + int kount1(0), kount2(0); + if (type == 0) { + const double tol1 = 0.00001; + for (auto it1 : matDDD) { + auto it2 = matDD4Hep.find(it1.first); + if (it2 != matDD4Hep.end()) { + ++kount1; + double rdif = + 0.5 * (it1.second.radl - it2->second.radl) / std::max(denmin, (it1.second.radl + it2->second.radl)); + double idif = + 0.5 * (it1.second.intl - it2->second.intl) / std::max(denmin, (it1.second.intl + it2->second.intl)); + if ((std::abs(rdif) > tol1) || (std::abs(idif) > tol1)) { + ++kount2; + std::cout << it1.first << " Radiation Length " << it1.second.radl << ":" << it2->second.radl << ":" << rdif + << " Interaction Length " << it1.second.intl << ":" << it2->second.intl << ":" << idif << std::endl; + } + } + } + std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol1 + << " or more\n"; + } else if (type == 1) { + const double tol2 = 0.0001; + for (auto it1 : solidDDD) { + auto it2 = solidDD4Hep.find(it1.first); + if (it2 != solidDD4Hep.end()) { + ++kount1; + double vdif = + 0.5 * (it1.second.volume - it2->second.volume) / std::max(denmin, (it1.second.volume + it2->second.volume)); + if (std::abs(vdif) > tol2) { + ++kount2; + std::cout << it1.first << " Volume " << it1.second.volume << ":" << it2->second.volume << ":" << vdif + << std::endl; + } + } + } + std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol2 + << " or more\n"; + } else if (type == 2) { + const double tol3 = 0.0001; + for (auto it1 : lvDDD) { + auto it2 = lvDD4Hep.find(it1.first); + if (it2 != lvDD4Hep.end()) { + ++kount1; + double vdif = + 0.5 * (it1.second.mass - it2->second.mass) / std::max(denmin, (it1.second.mass + it2->second.mass)); + if (std::abs(vdif) > tol3) { + ++kount2; + std::cout << it1.first << " Mass " << it1.second.mass << ":" << it2->second.mass << ":" << vdif << std::endl; + } + } + } + std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol3 + << " or more\n"; + } else { + const double tol4 = 0.0001; + for (auto it1 : pvDDD) { + auto it2 = pvDD4Hep.find(it1.first); + if (it2 != pvDD4Hep.end()) { + ++kount1; + double xdif = (it1.second.xx - it2->second.xx); + double ydif = (it1.second.yy - it2->second.yy); + double zdif = (it1.second.zz - it2->second.zz); + if ((std::abs(xdif) > tol4) || (std::abs(ydif) > tol4) || (std::abs(zdif) > tol4)) { + ++kount2; + std::cout << it1.first << " x " << it1.second.xx << ":" << it2->second.xx << ":" << xdif << " y " + << it1.second.yy << ":" << it2->second.yy << ":" << ydif << " z " << it1.second.zz << ":" + << it2->second.zz << ":" << zdif << std::endl; + } + } + } + std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol4 + << " or more\n"; } } int main(int argc, char* argv[]) { - if (argc <= 3) { + if (argc <= 4) { std::cout << "Please give a minimum of 2 arguments \n" << "input file name from the DDD run\n" << "input file name from the DD4Hep run\n" + << "type (Material:0, Solid:1, LV:2, PV:3\n" << "mode (treat the name for DDD or not == needed for PV)\n" << "debug flag (0 for minimum printout)\n" << std::endl; @@ -131,8 +350,11 @@ int main(int argc, char* argv[]) { const char* infile1 = argv[1]; const char* infile2 = argv[2]; - int mode = ((argc > 3) ? atoi(argv[3]) : 0); - int debug = ((argc > 4) ? atoi(argv[4]) : 0); - CompareFiles(infile1, infile2, mode, debug); + int type = ((argc > 3) ? atoi(argv[3]) : 0); + if (type < 0 || type > 3) + type = 0; + int mode = ((argc > 4) ? atoi(argv[4]) : 0); + int debug = ((argc > 5) ? atoi(argv[5]) : 0); + CompareFiles(infile1, infile2, type, mode, debug); return 0; } diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py index a5b840de3c96d..0f4fabab119c3 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py @@ -16,6 +16,7 @@ if hasattr(process,'MessageLogger'): process.MessageLogger.G4cerr=dict() process.MessageLogger.G4cout=dict() + process.g4SimHits.Watchers = cms.VPSet(cms.PSet( DumpSummary = cms.untracked.bool(True), DumpLVTree = cms.untracked.bool(False), @@ -37,5 +38,6 @@ LVFileName = cms.untracked.string('lvfileDD4Hep.txt'), PVFileName = cms.untracked.string('pvfileDD4Hep.txt'), TouchFileName = cms.untracked.string('touchfileDD4Hep.txt'), + FileDetail = cms.untracked.bool(True), type = cms.string('PrintGeomInfoAction') )) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py index 18af92f3380bd..9e08e479fab45 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py @@ -15,7 +15,6 @@ process.load('FWCore.MessageService.MessageLogger_cfi') - from SimG4Core.PrintGeomInfo.g4PrintGeomInfo_cfi import * process = printGeomInfo(process) @@ -24,9 +23,6 @@ process.MessageLogger.G4cerr=dict() process.MessageLogger.G4cout=dict() - - -process.g4SimHits.g4GeometryDD4hepSource = cms.bool(False) process.g4SimHits.Watchers = cms.VPSet(cms.PSet( DumpSummary = cms.untracked.bool(True), DumpLVTree = cms.untracked.bool(False), @@ -48,5 +44,6 @@ LVFileName = cms.untracked.string('lvfileDDD.txt'), PVFileName = cms.untracked.string('pvfileDDD.txt'), TouchFileName = cms.untracked.string('touchfileDDD.txt'), + FileDetail = cms.untracked.bool(True), type = cms.string('PrintGeomInfoAction') )) diff --git a/SimG4Core/Watcher/interface/SimWatcher.h b/SimG4Core/Watcher/interface/SimWatcher.h index 9f8a90d10ae9b..5d076bfadd57d 100644 --- a/SimG4Core/Watcher/interface/SimWatcher.h +++ b/SimG4Core/Watcher/interface/SimWatcher.h @@ -24,29 +24,13 @@ called by the dynamic loading code. // Created: Tue Nov 22 15:35:11 EST 2005 // -// system include files - -// user include files - -// forward declarations - class SimWatcher { public: SimWatcher() {} virtual ~SimWatcher() {} - // ---------- const member functions --------------------- - - // ---------- static member functions -------------------- - - // ---------- member functions --------------------------- - -private: - SimWatcher(const SimWatcher &) = delete; // stop default - - const SimWatcher &operator=(const SimWatcher &) = delete; // stop default - - // ---------- member data -------------------------------- + SimWatcher(const SimWatcher &) = delete; + const SimWatcher &operator=(const SimWatcher &) = delete; }; #endif diff --git a/SimPPS/Configuration/test/gluglu_step1_GEN_SIM_2021.py b/SimPPS/Configuration/test/gluglu_step1_GEN_SIM_2021.py index feb3216d5130f..372f1518414e5 100644 --- a/SimPPS/Configuration/test/gluglu_step1_GEN_SIM_2021.py +++ b/SimPPS/Configuration/test/gluglu_step1_GEN_SIM_2021.py @@ -7,7 +7,6 @@ process = cms.Process('SIM',eras.Run3) # import of standard configurations -process.load("CondCore.CondDB.CondDB_cfi") process.load('Configuration.StandardSequences.Services_cff') process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') @@ -19,8 +18,7 @@ process.load('Configuration.StandardSequences.SimIdeal_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - -process.load('Configuration.Geometry.GeometryExtended2021_cff') +process.load('Configuration.StandardSequences.GeometrySimDB_cff') process.RandomNumberGeneratorService.generator.initialSeed = cms.untracked.uint32(random.randint(0,900000000)) @@ -33,38 +31,30 @@ ) process.source = cms.Source("EmptySource") -""" -process.source = cms.Source("EmptySource", - firstRun = cms.untracked.uint32(324612), #2018D - firstTime = cms.untracked.uint64(6612348794983940096) -) -""" + from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') -#process.GlobalTag = GlobalTag(process.GlobalTag, "106X_dataRun2_v26") # generator - - process.generator = cms.EDFilter("ExhumeGeneratorFilter", ExhumeParameters = cms.PSet( AlphaEw = cms.double(0.0072974), B = cms.double(4.0), - BottomMass = cms.double(4.6), - CharmMass = cms.double(1.42), - HiggsMass = cms.double(120.0), + MuonMass = cms.double(0.1057), + BottomMass = cms.double(4.65), + CharmMass = cms.double(1.28), + StrangeMass = cms.double(0.095), + TauMass = cms.double(1.78), + TopMass = cms.double(172.8), + WMass = cms.double(80.38), + ZMass = cms.double(91.187), + HiggsMass = cms.double(125.1), HiggsVev = cms.double(246.0), LambdaQCD = cms.double(80.0), MinQt2 = cms.double(0.64), - MuonMass = cms.double(0.1057), PDF = cms.double(11000), Rg = cms.double(1.2), - StrangeMass = cms.double(0.19), - Survive = cms.double(0.03), - TauMass = cms.double(1.77), - TopMass = cms.double(175.0), - WMass = cms.double(80.33), - ZMass = cms.double(91.187) + Survive = cms.double(0.03) ), ExhumeProcess = cms.PSet( MassRangeHigh = cms.double(2000.0), @@ -75,7 +65,7 @@ PythiaParameters = cms.PSet( parameterSets = cms.vstring() ), - comEnergy = cms.double(13000.0), + comEnergy = cms.double(14000.0), maxEventsToPrint = cms.untracked.int32(2), pythiaHepMCVerbosity = cms.untracked.bool(False), pythiaPylistVerbosity = cms.untracked.int32(1) @@ -88,7 +78,6 @@ version = cms.untracked.string('$Revision: 1.19 $') ) - process.ProductionFilterSequence = cms.Sequence(process.generator) ############ @@ -100,7 +89,6 @@ process.generation_step = cms.Path(process.pgen) process.simulation_step = cms.Path(process.psim) - process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) process.outpath = cms.EndPath(process.o1) process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.outpath) diff --git a/SimPPS/Configuration/test/gluglu_step2_DIGI_DIGI2RAW_2021.py b/SimPPS/Configuration/test/gluglu_step2_DIGI_DIGI2RAW_2021.py index cd6f1a903423e..0c064b2202850 100644 --- a/SimPPS/Configuration/test/gluglu_step2_DIGI_DIGI2RAW_2021.py +++ b/SimPPS/Configuration/test/gluglu_step2_DIGI_DIGI2RAW_2021.py @@ -8,9 +8,8 @@ process = cms.Process('DIGI2RAW',eras.Run3) # import of standard configurations -process.load("CondCore.CondDB.CondDB_cfi") process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +#process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.MagneticField_cff') @@ -20,11 +19,7 @@ process.load('Configuration.StandardSequences.DigiToRaw_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - -# Since the PPS simulation geometry is not yet in the database, the line below is needed process.load('Configuration.StandardSequences.GeometryDB_cff') -#process.load("Geometry.VeryForwardGeometry.geometryPPS_CMSxz_fromDD_2021_cfi") -process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi") # Input source process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)) @@ -70,8 +65,8 @@ filterName = cms.untracked.string('') ), eventAutoFlushCompressedSize = cms.untracked.int32(5242880), - fileName = cms.untracked.string('GluGlu_step2_DIGI_DIGI2RAW2021.root'), - outputCommands = process.FEVTDEBUGEventContent.outputCommands + ['keep *_CTPPS*_*_*',"keep *_*RP*_*_*",'keep *_LHCTransport_*_*'], + fileName = cms.untracked.string('GluGlu_step2_DIGI_DIGI2RAW_2021.root'), + outputCommands = process.FEVTDEBUGEventContent.outputCommands + ['keep *_CTPPS*_*_*',"keep *_*RP*_*_*",'keep *_generatorSmeared_*_*'], splitLevel = cms.untracked.int32(0) ) @@ -79,7 +74,6 @@ # Other statements from Configuration.AlCa.GlobalTag import GlobalTag -#process.GlobalTag = GlobalTag(process.GlobalTag, '111X_mcRun3_2021_realistic_Candidate_2020_06_03_17_55_10', '') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') diff --git a/SimPPS/Configuration/test/gluglu_step3_RAW2DIGI_L1Reco_RECO_2021.py b/SimPPS/Configuration/test/gluglu_step3_RAW2DIGI_L1Reco_RECO_2021.py index 96ad558ba4ee3..6285a935d66c3 100644 --- a/SimPPS/Configuration/test/gluglu_step3_RAW2DIGI_L1Reco_RECO_2021.py +++ b/SimPPS/Configuration/test/gluglu_step3_RAW2DIGI_L1Reco_RECO_2021.py @@ -12,26 +12,19 @@ process.load("Configuration.EventContent.EventContent_cff") process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi") -#process.load("Geometry.VeryForwardGeometry.geometryPPS_CMSxz_fromDD_2021_cfi") # CMS frame process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) -process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) -) - # Input source process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring('file:GluGlu_step2_DIGI_DIGI2RAW2021.root'), + fileNames = cms.untracked.vstring('file:GluGlu_step2_DIGI_DIGI2RAW_2021.root'), secondaryFileNames = cms.untracked.vstring() ) @@ -45,31 +38,18 @@ # Output definition process.output = cms.OutputModule("PoolOutputModule", - fileName = cms.untracked.string('GluGlu_step3_RAW2DIGI_RECO2021.root'), - outputCommands = cms.untracked.vstring("drop *","keep SimVertexs_g4SimHits_*_*","keep PSimHits*_*_*_*","keep CTPPS*_*_*_*","keep *_*RP*_*_*",'keep *_LHCTransport_*_*') + fileName = cms.untracked.string('GluGlu_step3_RAW2DIGI_RECO_2021.root'), + outputCommands = cms.untracked.vstring("drop *","keep SimVertexs_g4SimHits_*_*","keep PSimHits*_*_*_*","keep CTPPS*_*_*_*","keep *_*RP*_*_*",'keep *_generatorSmeared_*_*') ) - # Additional output definition # Other statements from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') -# modify CTPPS 2018 raw-to-digi modules ONLY FOR PARTICLE GUN, TO AVOID RUN THIS FOR THE WHOLE CMS -process.load('Configuration.StandardSequences.RawToDigi_cff') - -# do not make testID for simulation - keeping the frame -from EventFilter.CTPPSRawToDigi.totemRPRawToDigi_cfi import totemRPRawToDigi -totemRPRawToDigi.RawToDigi.testID = cms.uint32(1) - -from RecoPPS.Local.totemRPLocalReconstruction_cff import totemRPLocalReconstruction -process.load('RecoPPS.Local.totemRPLocalReconstruction_cff') -from RecoPPS.Local.ctppsPixelLocalReconstruction_cff import ctppsPixelLocalReconstruction -process.load('RecoPPS.Local.ctppsPixelLocalReconstruction_cff') - # Path and EndPath definitions -process.raw2digi_step = cms.Path(process.ctppsRawToDigi) -process.reco_step = cms.Path(process.totemRPLocalReconstruction*process.ctppsPixelLocalReconstruction) +process.raw2digi_step = cms.Path(process.RawToDigi) +process.reco_step = cms.Path(process.reconstruction) process.endjob_step = cms.EndPath(process.endOfProcess) process.output_step = cms.EndPath(process.output) @@ -80,4 +60,3 @@ for path in process.paths: # getattr(process,path)._seq = process.ProductionFilterSequence * getattr(process,path)._seq getattr(process,path)._seq = getattr(process,path)._seq - diff --git a/SimPPS/Configuration/test/pg_step1_GEN_SIM_2021.py b/SimPPS/Configuration/test/pg_step1_GEN_SIM_2021.py index 1683c82c0b6cf..7b3006bf72ebb 100644 --- a/SimPPS/Configuration/test/pg_step1_GEN_SIM_2021.py +++ b/SimPPS/Configuration/test/pg_step1_GEN_SIM_2021.py @@ -7,7 +7,6 @@ process = cms.Process('SIM',eras.Run3) # import of standard configurations -process.load("CondCore.CondDB.CondDB_cfi") process.load('Configuration.StandardSequences.Services_cff') process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') @@ -19,8 +18,7 @@ process.load('Configuration.StandardSequences.SimIdeal_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - -process.load('Configuration.Geometry.GeometryExtended2021_cff') +process.load('Configuration.StandardSequences.GeometrySimDB_cff') process.RandomNumberGeneratorService.generator.initialSeed = cms.untracked.uint32(random.randint(0,900000000)) @@ -33,25 +31,30 @@ ) process.source = cms.Source("EmptySource") -""" -process.source = cms.Source("EmptySource", - firstRun = cms.untracked.uint32(324612), #2018D - firstTime = cms.untracked.uint64(6612348794983940096) -) -""" from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') -#process.GlobalTag = GlobalTag(process.GlobalTag, "106X_dataRun2_v26") - +#process.GlobalTag = GlobalTag(process.GlobalTag, '113X_mcRun3_2021_realistic_Candidate_2021_04_06_19_59_53', '') # generator +""" +process.GlobalTag.toGet = cms.VPSet( + cms.PSet( + record = cms.string('LHCInfoRcd'), + tag = cms.string("LHCInfo_2021_mc_v1") + ), + cms.PSet( + record = cms.string('CTPPSOpticsRcd'), + tag = cms.string("PPSOpticalFunctions_2021_mc_v1") + ) + ) +""" phi_min = -math.pi phi_max = math.pi t_min = 0. t_max = 2. -xi_min = 0.03 -xi_max = 0.15 -ecms = 13000. +xi_min = 0.02 +xi_max = 0.20 +ecms = 14000. # ATTENTION: if using HECTOR propagator, currently the energy is hardcoded as 6500 but the optics file is prepared for 7 TeV process.generator = cms.EDProducer("RandomtXiGunProducer", PGunParameters = cms.PSet( @@ -90,4 +93,3 @@ # filter all path with the production filter sequence for path in process.paths: getattr(process,path)._seq = process.ProductionFilterSequence * getattr(process,path)._seq - diff --git a/SimPPS/Configuration/test/pg_step2_DIGI_DIGI2RAW_2021.py b/SimPPS/Configuration/test/pg_step2_DIGI_DIGI2RAW_2021.py index ab5de7b118360..6e6ddf79eeb36 100644 --- a/SimPPS/Configuration/test/pg_step2_DIGI_DIGI2RAW_2021.py +++ b/SimPPS/Configuration/test/pg_step2_DIGI_DIGI2RAW_2021.py @@ -8,9 +8,8 @@ process = cms.Process('DIGI2RAW',eras.Run3) # import of standard configurations -process.load("CondCore.CondDB.CondDB_cfi") process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +#process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.MagneticField_cff') @@ -20,11 +19,10 @@ process.load('Configuration.StandardSequences.DigiToRaw_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.StandardSequences.GeometryDB_cff') # Since the PPS simulation geometry is not yet in the database, the line below is needed -process.load('Configuration.StandardSequences.GeometryDB_cff') #process.load("Geometry.VeryForwardGeometry.geometryPPS_CMSxz_fromDD_2021_cfi") -process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi") # Input source process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)) @@ -71,7 +69,7 @@ ), eventAutoFlushCompressedSize = cms.untracked.int32(5242880), fileName = cms.untracked.string('step2_DIGI_DIGI2RAW2021.root'), - outputCommands = process.FEVTDEBUGEventContent.outputCommands + ['keep *_CTPPS*_*_*',"keep *_*RP*_*_*",'keep *_LHCTransport_*_*'], + outputCommands = process.FEVTDEBUGEventContent.outputCommands + ['keep *_CTPPS*_*_*',"keep *_*RP*_*_*",'keep *_generatorSmeared_*_*'], splitLevel = cms.untracked.int32(0) ) @@ -79,7 +77,7 @@ # Other statements from Configuration.AlCa.GlobalTag import GlobalTag -#process.GlobalTag = GlobalTag(process.GlobalTag, '111X_mcRun3_2021_realistic_Candidate_2020_06_03_17_55_10', '') +#process.GlobalTag = GlobalTag(process.GlobalTag, '113X_mcRun3_2021_realistic_Candidate_2021_04_06_19_59_53', '') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') diff --git a/SimPPS/Configuration/test/pg_step3_MCDB_RAW2DIGI_RECO_2021.py b/SimPPS/Configuration/test/pg_step3_MCDB_RAW2DIGI_RECO_2021.py index 0131e8b73d3e4..813355a55dd12 100644 --- a/SimPPS/Configuration/test/pg_step3_MCDB_RAW2DIGI_RECO_2021.py +++ b/SimPPS/Configuration/test/pg_step3_MCDB_RAW2DIGI_RECO_2021.py @@ -13,22 +13,17 @@ process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi") -#process.load("Geometry.VeryForwardGeometry.geometryPPS_CMSxz_fromDD_2021_cfi") # CMS frame - +#process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi") +#process.load("Geometry.VeryForwardGeometry.geometryPPS_CMSxz_fromDD_2018_cfi") # CMS frame, 2021 = 2018 +#process.load('CalibPPS.ESProducers.ppsPixelTopologyESSourceRun2_cfi') # temporary solution, the 2021 geometry is the same as run2, force the usage of run2 topology process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) -process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) -) - # Input source process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring('file:step2_DIGI_DIGI2RAW2021.root'), @@ -46,7 +41,7 @@ process.output = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('step3_RAW2DIGI_RECO2021.root'), - outputCommands = cms.untracked.vstring("drop *","keep SimVertexs_g4SimHits_*_*","keep PSimHits*_*_*_*","keep CTPPS*_*_*_*","keep *_*RP*_*_*",'keep *_LHCTransport_*_*') + outputCommands = cms.untracked.vstring("drop *","keep SimVertexs_g4SimHits_*_*","keep PSimHits*_*_*_*","keep CTPPS*_*_*_*","keep *_*RP*_*_*",'keep *_generatorSmeared_*_*') ) @@ -54,22 +49,13 @@ # Other statements from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') - -# modify CTPPS 2018 raw-to-digi modules ONLY FOR PARTICLE GUN, TO AVOID RUN THIS FOR THE WHOLE CMS -process.load('Configuration.StandardSequences.RawToDigi_cff') - -# do not make testID for simulation - keeping the frame -from EventFilter.CTPPSRawToDigi.totemRPRawToDigi_cfi import totemRPRawToDigi -totemRPRawToDigi.RawToDigi.testID = cms.uint32(1) - -from RecoPPS.Local.totemRPLocalReconstruction_cff import totemRPLocalReconstruction -process.load('RecoPPS.Local.totemRPLocalReconstruction_cff') -from RecoPPS.Local.ctppsPixelLocalReconstruction_cff import ctppsPixelLocalReconstruction -process.load('RecoPPS.Local.ctppsPixelLocalReconstruction_cff') +#process.GlobalTag = GlobalTag(process.GlobalTag, '113X_mcRun3_2021_realistic_Candidate_2021_04_06_19_59_53', '') # Path and EndPath definitions -process.raw2digi_step = cms.Path(process.ctppsRawToDigi) -process.reco_step = cms.Path(process.totemRPLocalReconstruction*process.ctppsPixelLocalReconstruction) +#process.raw2digi_step = cms.Path(process.RawToDigi) +#process.reco_step = cms.Path(process.reconstruction) +process.raw2digi_step = cms.Path(process.ctppsRawToDigi) # to avoid full CMS digitization +process.reco_step = cms.Path(process.totemRPLocalReconstruction*process.ctppsPixelLocalReconstruction) # to avoid full CMS reconstruction process.endjob_step = cms.EndPath(process.endOfProcess) process.output_step = cms.EndPath(process.output) @@ -80,4 +66,3 @@ for path in process.paths: # getattr(process,path)._seq = process.ProductionFilterSequence * getattr(process,path)._seq getattr(process,path)._seq = getattr(process,path)._seq - diff --git a/SimTracker/SiPhase2Digitizer/plugins/Pixel3DDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/Pixel3DDigitizerAlgorithm.cc index 3d80a683a7cff..421425ebe40f7 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Pixel3DDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Pixel3DDigitizerAlgorithm.cc @@ -158,56 +158,45 @@ std::vector Pixel3DDigitizerAlgorithm::diff << "\nMigration axis: " << displ_ind << "\n(super-)Charge distance to the pixel edge: " << (pitch - pos_moving[displ_ind]) * 1.0_um_inv << " [um]"; - // FIXME -- Sigma reference, DM? - const float distance0 = 300.0_um; - const float sigma0 = 3.4_um; - // FIXME -- Tolerance, DM? - const float TOL = 1e-6; // How many sigmas (probably a configurable, to be decided not now) const float N_SIGMA = 3.0; // Start the drift and check every step - // initial position - int i = 0; // Some variables needed float current_carriers = ncarriers; std::vector newpos({pos_moving[0], pos_moving[1], pos_moving[2]}); float distance_edge = 0.0_um; - do { + // Current diffusion value + const float sigma = 0.4_um; + for (int i = 1;; ++i) { std::transform(pos_moving.begin(), pos_moving.end(), do_step(i).begin(), pos_moving.begin(), std::plus()); distance_edge = pitch - std::abs(pos_moving[displ_ind]); - // current diffusion value - double sigma = std::sqrt(i * diffusion_step / distance0) * (distance0 / thickness) * sigma0; // Get the amount of charge on the neighbor pixel: note the // transformation to a Normal - float migrated_e = current_carriers * 0.5 * (1.0 - std::erf(distance_edge / sigma)); + float migrated_e = current_carriers * 0.5 * (1.0 - std::erf(distance_edge / (sigma * std::sqrt(2.0)))); - LogDebug("(super-)charge diffusion") << "step-" << i << ", Initial Ne= " << ncarriers << ", " + LogDebug("(super-)charge diffusion") << "step-" << i << ", Current carriers Ne= " << current_carriers << "," << "r=(" << pos_moving[0] * 1.0_um_inv << ", " << pos_moving[1] * 1.0_um_inv << ", " << pos_moving[2] * 1.0_um_inv << ") [um], " << "Migrated charge: " << migrated_e; - // No charge was migrated (ignore creation time) - if (i != 0) { - // At least 1 electron migrated - if ((migrated_e - TOL) < 1.0) { - break; - } - // Move the migrated charge - current_carriers -= migrated_e; - // Create the ionization point: - // First update the newpos vector: the new charge positions at the neighbourg pixels - // are created in the same position that its "parent carriers" - // except the direction of migration - std::vector newpos(pos_moving); - // Lest create the new charges around 3 sigmas away - newpos[displ_ind] += std::copysign(N_SIGMA * sigma, newpos[displ_ind]); - migrated_charge.push_back(DigitizerUtility::EnergyDepositUnit(migrated_e, newpos[0], newpos[1], newpos[2])); + // Move the migrated charge + current_carriers -= migrated_e; + + // Either far away from the edge or almost half of the carriers already migrated + if (std::abs(distance_edge) >= max_migration_radius || current_carriers <= 0.5 * ncarriers) { + break; } - // Next step - ++i; - } while (std::abs(distance_edge) < max_migration_radius && current_carriers > 0.5 * ncarriers); + // Create the ionization point: + // First update the newpos vector: the new charge position at the neighbouring pixel + // is created in the same position as its "parent carriers" + // except the direction of migration + std::vector newpos(pos_moving); + // Let's create the new charge carriers around 3 sigmas away + newpos[displ_ind] += std::copysign(N_SIGMA * sigma, newpos[displ_ind]); + migrated_charge.push_back(DigitizerUtility::EnergyDepositUnit(migrated_e, newpos[0], newpos[1], newpos[2])); + } return migrated_charge; } @@ -230,10 +219,10 @@ std::vector Pixel3DDigitizerAlgorithm::drift( const GlobalVector& bfield, const std::vector& ionization_points, bool diffusion_activated) const { - // -- Current reference system is placed in the center on the module + // -- Current reference system is placed in the center of the module // -- The natural reference frame should be discribed taking advantatge of // -- the cylindrical nature of the pixel geometry --> - // -- the new reference frame should be place in the center of the columncy, and in the + // -- the new reference frame should be placed in the center of the n-column, and in the // -- surface of the ROC using cylindrical coordinates // Get ROC pitch, half_pitch and sensor thickness to be used to create the @@ -245,7 +234,7 @@ std::vector Pixel3DDigitizerAlgorithm::drift( const int ncolumns = pixdet->specificTopology().ncolumns(); const float pix_rounding = 0.99; - // the maximum radial distance is going to be use to evaluate radiation damage XXX? + // The maximum radial distance is going to be used to evaluate radiation damage XXX? const float max_radial_distance = std::sqrt(half_pitch.first * half_pitch.first + half_pitch.second * half_pitch.second); @@ -303,7 +292,7 @@ std::vector Pixel3DDigitizerAlgorithm::drift( << "(super-)Charge\nlocal position: (" << super_charge.x() * 1.0_um_inv << ", " << super_charge.y() * 1.0_um_inv << ", " << super_charge.z() * 1.0_um_inv << ") [um]" << "\nMeasurement Point (row,column) (" << current_pixel.first << ", " << current_pixel.second << ")" - << "\nProxy pixel-cell frame (centered at left-down corner): (" << relative_position_at_pc.first * 1.0_um_inv + << "\nProxy pixel-cell frame (centered at left-back corner): (" << relative_position_at_pc.first * 1.0_um_inv << ", " << relative_position_at_pc.second * 1.0_um_inv << ") [um]" << "\nProxy pixel-cell frame (centered at n-column): (" << position_at_pc.x() * 1.0_um_inv << ", " << position_at_pc.y() * 1.0_um_inv << ") [um] " @@ -319,8 +308,8 @@ std::vector Pixel3DDigitizerAlgorithm::drift( // XXX -- Diffusion: using the center frame if (diffusion_activated) { auto migrated_charges = diffusion(position_at_pc, super_charge.energy(), drift_direction, half_pitch, thickness); - // remove the migrated charges for (auto& mc : migrated_charges) { + // Remove the migrated charges nelectrons -= mc.energy(); // and convert back to the pixel ref. system // Low-left origin/pitch -> relative within the pixel (a) @@ -328,8 +317,10 @@ std::vector Pixel3DDigitizerAlgorithm::drift( const float pixel_x = current_pixel_int.first + (mc.x() + center_proxy_cell.x()) / pitch.first; const float pixel_y = current_pixel_int.second + (mc.y() + center_proxy_cell.y()) / pitch.second; const auto lp = pixdet->specificTopology().localPosition(MeasurementPoint(pixel_x, pixel_y)); - //Remember: the drift function will move the reference system to the bottom. We need to add what we previously subtract - //in order to avoid a double translation when calling the drift function once again below + // Remember: the drift function will move the reference system to the top. We need to subtract + // (center_proxy_cell.z() is a constant negative value) what we previously added in order to + // avoid a double translation when calling the drift function below the drift function + // initially considers the reference system centered in the module at half thickness) mc.migrate_position(LocalPoint(lp.x(), lp.y(), mc.z() + center_proxy_cell.z())); } if (!migrated_charges.empty()) { @@ -412,6 +403,5 @@ void Pixel3DDigitizerAlgorithm::induce_signal(const PSimHit& hit, << " Induce charge at row,col:" << pt.position() << " N_electrons:" << pt.amplitude() << " [Channel:" << channel << "]\n [Accumulated signal in this channel:" << the_signal[channel].ampl() << "] " << " Global index linked PSimHit:" << hitIndex; - ; } } diff --git a/SimTracker/SiPhase2Digitizer/python/PixelTestBeamValidation_cfi.py b/SimTracker/SiPhase2Digitizer/python/PixelTestBeamValidation_cfi.py index ff7accf0ef1f7..400bf88f511a4 100644 --- a/SimTracker/SiPhase2Digitizer/python/PixelTestBeamValidation_cfi.py +++ b/SimTracker/SiPhase2Digitizer/python/PixelTestBeamValidation_cfi.py @@ -48,6 +48,14 @@ xmin = cms.double(-150), xmax = cms.double(150) ) +Dxy2D = cms.PSet( + Nxbins = cms.int32(Nx), + Nybins = cms.int32(Ny), + xmin = cms.double(-50), + xmax = cms.double(50), + ymin = cms.double(-150), + ymax = cms.double(150) + ) SimClusterCharge = cms.PSet( Nxbins = cms.int32(300), Nybins = cms.int32(201), @@ -109,6 +117,7 @@ dqmcell = DQMEDAnalyzer('PixelTestBeamValidation', # WARNING: be sure it is the same value used with the Pixel3DDigitizer + ThresholdInElectrons = cms.double(1000.0), ElectronsPerADC = cms.double(1600.0), TracksEntryAngleX = cms.untracked.vdouble(-np.radians(2.0),np.radians(2.0)), TracksEntryAngleY = cms.untracked.vdouble(-np.radians(2.0),np.radians(2.0)), @@ -143,6 +152,7 @@ DigiRZ = TrackRZ.clone(), Dx1D = Dx1D.clone(), Dy1D = Dy1D.clone(), + Dxy2D = Dxy2D.clone(), DigiCharge1D = DigiCharge1D.clone(), SimClusterCharge = SimClusterCharge.clone(), diff --git a/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.cc b/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.cc index d7145e4c8ef7e..484edcce93521 100644 --- a/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.cc +++ b/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.cc @@ -20,6 +20,7 @@ #include "DataFormats/Math/interface/CMSUnits.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h" // system #include @@ -40,6 +41,7 @@ PixelTestBeamValidation::PixelTestBeamValidation(const edm::ParameterSet& iConfi : config_(iConfig), geomType_(iConfig.getParameter("GeometryType")), //phiValues(iConfig.getParameter >("PhiAngles")), + thresholdInElectrons_(iConfig.getParameter("ThresholdInElectrons")), electronsPerADC_(iConfig.getParameter("ElectronsPerADC")), tracksEntryAngleX_( iConfig.getUntrackedParameter>("TracksEntryAngleX", std::vector())), @@ -51,6 +53,9 @@ PixelTestBeamValidation::PixelTestBeamValidation(const edm::ParameterSet& iConfi simTrackToken_(consumes(iConfig.getParameter("SimTrackSource"))) { LogDebug("PixelTestBeamValidation") << ">>> Construct PixelTestBeamValidation "; + // The value to be used for ToT == 0 in electrons + electronsAtToT0_ = 0.5 * (thresholdInElectrons_ + electronsPerADC_); + const std::vector psimhit_v(config_.getParameter>("PSimHitSource")); for (const auto& itag : psimhit_v) { @@ -265,11 +270,14 @@ void PixelTestBeamValidation::analyze(const edm::Event& iEvent, const edm::Event vME_digi_RZMap_->Fill(digi_global_pos.z(), std::hypot(digi_global_pos.x(), digi_global_pos.y())); // Create the MC-cluster cluster_tot += current_digi.adc(); - // Add 0.5 to allow ToT = 0 (valid value) - cluster_tot_elec += (current_digi.adc() + 0.5) * electronsPerADC_; + // Assign the middle value between the threshold and the ElectronPerADC parameter + // to the first bin in order to allow ToT = 0 (valid value) + const double pixel_charge_elec = + (bool(current_digi.adc()) ? (current_digi.adc() * electronsPerADC_) : electronsAtToT0_); + cluster_tot_elec += pixel_charge_elec; // Use the center of the pixel - cluster_position.first += current_digi.adc() * (current_digi.row() + 0.5); - cluster_position.second += current_digi.adc() * (current_digi.column() + 0.5); + cluster_position.first += pixel_charge_elec * (current_digi.row() + 0.5); + cluster_position.second += pixel_charge_elec * (current_digi.column() + 0.5); // Size cluster_size_xy.first.insert(current_digi.row()); cluster_size_xy.second.insert(current_digi.column()); @@ -282,8 +290,8 @@ void PixelTestBeamValidation::analyze(const edm::Event& iEvent, const edm::Event vME_clsize1Dy_[me_unit]->Fill(cluster_size_xy.second.size()); // mean weighted - cluster_position.first /= double(cluster_tot); - cluster_position.second /= double(cluster_tot); + cluster_position.first /= cluster_tot_elec; + cluster_position.second /= cluster_tot_elec; // -- XXX Be careful, secondaries with already used the digis // are going the be lost (then lost on efficiency) @@ -302,6 +310,7 @@ void PixelTestBeamValidation::analyze(const edm::Event& iEvent, const edm::Event vME_charge_elec1D_[me_unit]->Fill(cluster_tot_elec); vME_dx1D_[me_unit]->Fill(dx_um); vME_dy1D_[me_unit]->Fill(dy_um); + vME_dxy2D_[me_unit]->Fill(dx_um, dy_um); // The track energy loss corresponding to that cluster vME_sim_cluster_charge_[me_unit]->Fill(psh->energyLoss() * 1.0_inv_keV, cluster_tot_elec); } @@ -430,7 +439,11 @@ void PixelTestBeamValidation::bookHistograms(DQMStore::IBooker& ibooker, vME_dx1D_[me_unit] = setupH1D_( ibooker, "Dx1D", "MC-truth DIGI cluster residuals X;x_{PSimHit}-x^{cluster}_{digi} [#mum];N_{digi clusters}"); vME_dy1D_[me_unit] = setupH1D_( - ibooker, "Dy1D", "MC-truth DIGI cluster residual Ys;y_{PSimHit}-y^{cluster}_{digi} [#mum];N_{digi clusters}"); + ibooker, "Dy1D", "MC-truth DIGI cluster residual Y;y_{PSimHit}-y^{cluster}_{digi} [#mum];N_{digi clusters}"); + vME_dxy2D_[me_unit] = setupH2D_(ibooker, + "Dxy2D", + "MC-truth DIGI cluster residuals;x_{PSimHit}-x^{cluster}_{digi} " + "[#mum];y_{PSimHit}-y^{cluster}_{digi} [#mum];N_{digi clusters}"); vME_digi_charge1D_[me_unit] = setupH1D_(ibooker, "DigiCharge1D", "Digi charge;digi charge [ToT];N_{digi}"); vME_sim_cluster_charge_[me_unit] = setupH2D_(ibooker, @@ -712,8 +725,12 @@ std::set> PixelTestBeamValidation::get_illuminated_pixels_(c const double max_x = std::max(ps.entryPoint().x(), ps.exitPoint().x()); const double max_y = std::max(ps.entryPoint().y(), ps.exitPoint().y()); // Get the position in readout units for each point - const auto min_pos = tkDetUnit->specificTopology().measurementPosition(LocalPoint(min_x, min_y)); - const auto max_pos = tkDetUnit->specificTopology().measurementPosition(LocalPoint(max_x, max_y)); + const auto min_pos_pre = tkDetUnit->specificTopology().measurementPosition(LocalPoint(min_x, min_y)); + const auto max_pos_pre = tkDetUnit->specificTopology().measurementPosition(LocalPoint(max_x, max_y)); + // Adding a unit at each side in order to include charge migration + const MeasurementPoint min_pos(std::max(0.0, min_pos_pre.x() - 1.0), std::max(0.0, min_pos_pre.y() - 1.0)); + const MeasurementPoint max_pos(std::min(max_pos_pre.x() + 1.0, tkDetUnit->specificTopology().nrows() - 1.0), + std::min(max_pos_pre.y() + 1.0, tkDetUnit->specificTopology().ncolumns() - 1.0)); // Count how many cells has passed. Use the most conservative rounding: // round for maximums and int (floor) for minimums //const int ncells_x = std::round(max_pos.x())-std::floor(min_pos.x()); diff --git a/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.h b/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.h index 25720d0020e37..9e85c5ad7f2c3 100644 --- a/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.h +++ b/SimTracker/SiPhase2Digitizer/test/PixelTestBeamValidation.h @@ -145,6 +145,7 @@ class PixelTestBeamValidation : public DQMEDAnalyzer { std::map vME_track_dydzAngle_; std::map vME_dx1D_; std::map vME_dy1D_; + std::map vME_dxy2D_; std::map vME_digi_charge1D_; std::map vME_digi_chargeElec1D_; std::map vME_sim_cluster_charge_; @@ -167,9 +168,11 @@ class PixelTestBeamValidation : public DQMEDAnalyzer { // Geometry to use std::string geomType_; - // The conversion between ToT to electrons (Be carefull, this should + // The threshold and the conversion between ToT to electrons (Be carefull, this should // be using the same value used in the digitization module) + double thresholdInElectrons_; double electronsPerADC_; + double electronsAtToT0_; // The tracks entry angle to accept (if any) std::vector tracksEntryAngleX_; std::vector tracksEntryAngleY_; diff --git a/SimTransport/PPSProtonTransport/python/OpticalFunctionsConfig_cfi.py b/SimTransport/PPSProtonTransport/python/OpticalFunctionsConfig_cfi.py index cb0e15c647d56..166b591201a7b 100644 --- a/SimTransport/PPSProtonTransport/python/OpticalFunctionsConfig_cfi.py +++ b/SimTransport/PPSProtonTransport/python/OpticalFunctionsConfig_cfi.py @@ -125,6 +125,29 @@ ) ) +_config_2021 = cms.PSet( + opticalFunctionConfig = cms.PSet( + es_source = cms.PSet( + validityRange = cms.EventRange("0:min - 999999:max"), + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(110.444), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2021/version_pre3/110.444urad.root") ), + cms.PSet( xangle = cms.double(184.017), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2021/version_pre3/184.017urad.root") ) + ) + ), + defaultCrossingAngle = cms.double(0.0) + ), + optics_parameters = cms.PSet( + empiricalAperture45_xi0_int = cms.double(0.079), + empiricalAperture45_xi0_slp = cms.double(4.211E-04), + empiricalAperture45_a_int = cms.double(42.8), + empiricalAperture45_a_slp = cms.double(0.669), + empiricalAperture56_xi0_int = cms.double(0.074), + empiricalAperture56_xi0_slp = cms.double(6.604E-04), + empiricalAperture56_a_int = cms.double(-22.7), + empiricalAperture56_a_slp = cms.double(1.600) + ) +) + _opticalfunctionsTransportSetup_2016_preTS2 =cms.PSet( opticalFunctionConfig = _config_2016_preTS2.opticalFunctionConfig, optics_parameters = cms.PSet(_baseOpticalFunctionsParameters,_config_2016_preTS2.optics_parameters) @@ -146,11 +169,17 @@ ) opticalfunctionsTransportSetup_2018 =cms.PSet( - opticalFunctionConfig = _config_2018.opticalFunctionConfig, - optics_parameters = cms.PSet(_baseOpticalFunctionsParameters, _config_2018.optics_parameters) + _baseOpticalFunctionsParameters, + _config_2018.opticalFunctionConfig, + _config_2018.optics_parameters +) + +opticalfunctionsTransportSetup_2021 =cms.PSet( + _baseOpticalFunctionsParameters, + _config_2021.opticalFunctionConfig, + _config_2021.optics_parameters ) # Default setup opticalfunctionsTransportSetup_2016 = _opticalfunctionsTransportSetup_2016_preTS2.clone() opticalfunctionsTransportSetup_2017 = _opticalfunctionsTransportSetup_2017_preTS2.clone() -opticalfunctionsTransportSetup_2021 = opticalfunctionsTransportSetup_2018.clone() diff --git a/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py b/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py index e4cbfd736e977..7e6afe9b0b041 100644 --- a/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py +++ b/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py @@ -1,19 +1,33 @@ import FWCore.ParameterSet.Config as cms # beam optics +from CondCore.CondDB.CondDB_cfi import * from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import * from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = "" - -# For optical functions from root file, when they are not yet in the database, use the definitino below """ -from SimTransport.PPSProtonTransport.OpticalFunctionsConfig_cfi import * +# For optical functions and LHCinfo not yet in a GT, use the definitino below +ppsTransportESSource = cms.ESSource("PoolDBESSource") + +_ppsESSource2021 = cms.ESSource("PoolDBESSource", + connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'), + timetype = cms.untracked.string('runnumber'), + toGet = cms.VPSet( + cms.PSet( + record = cms.string('LHCInfoRcd'), + tag = cms.string("LHCInfo_2021_mc_v1") + ), + cms.PSet( + record = cms.string('CTPPSOpticsRcd'), + tag = cms.string("PPSOpticalFunctions_2021_mc_v1") + ) + ) +) -_opticsConfig = cms.PSet( - defaultCrossingAngle=cms.double(0.0), - es_source = cms.PSet() - ) +from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 +ctpps_2021.toReplaceWith(ppsTransportESSource,_ppsESSource2021) +del _ppsESSource2021 from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 ctpps_2016.toReplaceWith(_opticsConfig, opticalfunctionsTransportSetup_2016.opticalFunctionConfig) diff --git a/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py b/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py index c494fff3d885e..ed23c0fadb786 100644 --- a/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py +++ b/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py @@ -25,8 +25,10 @@ from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 ctpps_2018.toReplaceWith(_LHCTransportPSet,_hector_2018) +#ctpps_2018.toReplaceWith(_LHCTransportPSet,_opticalfunctionsTransportSetup_2018) from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -ctpps_2021.toReplaceWith(_LHCTransportPSet, _hector_2021) # there is no LHCInfo tag for Run3 yet, force to use a nonDB propagation +#ctpps_2021.toReplaceWith(_LHCTransportPSet, _hector_2021) # there is no LHCInfo tag for Run3 yet, force to use a nonDB propagation +ctpps_2021.toReplaceWith(_LHCTransportPSet, _opticalfunctionsTransportSetup_2021) # there is no LHCInfo tag for Run3 yet, force to use a nonDB propagation LHCTransport = cms.EDProducer("PPSSimTrackProducer",_commonParameters,_LHCTransportPSet) diff --git a/SimTransport/TotemRPProtonTransportParametrization/src/SimTransportTotemRPProtTranspParLinkDef.h b/SimTransport/TotemRPProtonTransportParametrization/src/SimTransportTotemRPProtTranspParLinkDef.h deleted file mode 100644 index f1585e1fa74df..0000000000000 --- a/SimTransport/TotemRPProtonTransportParametrization/src/SimTransportTotemRPProtTranspParLinkDef.h +++ /dev/null @@ -1,17 +0,0 @@ -#include "SimTransport/TotemRPProtonTransportParametrization/interface/TMultiDimFet.h" -#include "SimTransport/TotemRPProtonTransportParametrization/interface/LHCOpticsApproximator.h" -#include - -#ifdef __CINT__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ class TMultiDimFet + ; -#pragma link C++ class LHCOpticsApproximator + ; -#pragma link C++ class LHCApertureApproximator + ; -#pragma link C++ class vector < LHCOpticsApproximator> + ; -#pragma link C++ class vector < LHCApertureApproximator> + ; - -#endif diff --git a/SimTransport/TotemRPProtonTransportParametrization/src/classes.h b/SimTransport/TotemRPProtonTransportParametrization/src/classes.h new file mode 100644 index 0000000000000..700bd27502403 --- /dev/null +++ b/SimTransport/TotemRPProtonTransportParametrization/src/classes.h @@ -0,0 +1,3 @@ +#include "SimTransport/TotemRPProtonTransportParametrization/interface/TMultiDimFet.h" +#include "SimTransport/TotemRPProtonTransportParametrization/interface/LHCOpticsApproximator.h" +#include diff --git a/SimTransport/TotemRPProtonTransportParametrization/src/classes_def.xml b/SimTransport/TotemRPProtonTransportParametrization/src/classes_def.xml new file mode 100644 index 0000000000000..b647bb8aa2ba1 --- /dev/null +++ b/SimTransport/TotemRPProtonTransportParametrization/src/classes_def.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/TrackingTools/RecoGeometry/src/GlobalDetLayerGeometry.cc b/TrackingTools/RecoGeometry/src/GlobalDetLayerGeometry.cc index 320c57543a8f9..d12c61b200af9 100644 --- a/TrackingTools/RecoGeometry/src/GlobalDetLayerGeometry.cc +++ b/TrackingTools/RecoGeometry/src/GlobalDetLayerGeometry.cc @@ -12,7 +12,8 @@ const DetLayer* GlobalDetLayerGeometry::idToLayer(const DetId& detId) const { else { throw cms::Exception("DetLayers") << "Error: called GlobalDetLayerGeometry::idToLayer() for a detId which is neither Tracker nor Muon " - << (mtd_ == nullptr ? "" : "nor MTD ") << detId; + << (mtd_ == nullptr ? "" : "nor MTD ") << " det rawId " << detId.rawId() << " det " << detId.det() + << " subdetId " << detId.subdetId(); } } diff --git a/Validation/CTPPS/python/simu_config/year_2021_cff.py b/Validation/CTPPS/python/simu_config/year_2021_cff.py index b9084f970c728..c8310d1f41a0b 100644 --- a/Validation/CTPPS/python/simu_config/year_2021_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2021_cff.py @@ -5,7 +5,7 @@ # base profile settings for 2021 profile_base_2021 = profile_base.clone( ctppsLHCInfo = dict( - beamEnergy = 6500 + beamEnergy = 7000 ), ctppsOpticalFunctions = dict( @@ -34,6 +34,9 @@ ) ) +# adjust basic settings +generator.energy = profile_base_2021.ctppsLHCInfo.beamEnergy + # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi import * ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag diff --git a/Validation/Configuration/python/globalValidation_cff.py b/Validation/Configuration/python/globalValidation_cff.py index 8ea73c681b963..cf25942c176d7 100644 --- a/Validation/Configuration/python/globalValidation_cff.py +++ b/Validation/Configuration/python/globalValidation_cff.py @@ -198,7 +198,7 @@ ) globalValidationHGCal = cms.Sequence(hgcalValidation) -globalPrevalidationHGCal = cms.Sequence(hgcalAssociators) +globalPrevalidationHGCal = cms.Sequence(hgcalAssociators, ticlSimTrackstersTask) globalValidationMTD = cms.Sequence() diff --git a/Validation/Configuration/python/hgcalSimValid_cff.py b/Validation/Configuration/python/hgcalSimValid_cff.py index 2fc76100faa36..3ac4142386bb0 100644 --- a/Validation/Configuration/python/hgcalSimValid_cff.py +++ b/Validation/Configuration/python/hgcalSimValid_cff.py @@ -10,6 +10,7 @@ from Validation.HGCalValidation.digiValidation_cff import * from Validation.HGCalValidation.rechitValidation_cff import * from Validation.HGCalValidation.hgcalHitValidation_cfi import * +from RecoHGCal.TICL.SimTracksters_cff import * from Validation.HGCalValidation.HGCalValidator_cfi import hgcalValidator from Validation.RecoParticleFlow.PFJetValidation_cff import pfJetValidation1 as _hgcalPFJetValidation @@ -17,6 +18,9 @@ from Validation.HGCalValidation.ticlPFValidation_cfi import ticlPFValidation hgcalTiclPFValidation = cms.Sequence(ticlPFValidation) +from Validation.HGCalValidation.ticlTrackstersEdgesValidation_cfi import ticlTrackstersEdgesValidation +hgcalTiclTrackstersEdgesValidationSequence = cms.Sequence(ticlTrackstersEdgesValidation) + hgcalValidatorSequence = cms.Sequence(hgcalValidator) hgcalPFJetValidation = _hgcalPFJetValidation.clone(BenchmarkLabel = 'PFJetValidation/HGCAlCompWithGenJet', VariablePtBins=[10., 30., 80., 120., 250., 600.], @@ -38,6 +42,8 @@ + hgcalHitValidationSequence + hgcalValidatorSequence + hgcalTiclPFValidation + #Currently commented out until trackster edges are saved +# + hgcalTiclTrackstersEdgesValidationSequence + hgcalPFJetValidation) _hfnose_hgcalAssociatorsTask = hgcalAssociators.copy() diff --git a/Validation/Geometry/interface/MaterialBudgetHcalHistos.h b/Validation/Geometry/interface/MaterialBudgetHcalHistos.h index 658aebc0584f4..9fbfccb25a2f6 100644 --- a/Validation/Geometry/interface/MaterialBudgetHcalHistos.h +++ b/Validation/Geometry/interface/MaterialBudgetHcalHistos.h @@ -38,15 +38,15 @@ class MaterialBudgetHcalHistos { std::vector getNames(DDFilteredView &fv); std::vector getNames(cms::DDFilteredView &fv); std::vector getDDDArray(const std::string &str, const DDsvalues_type &sv); - bool isSensitive(std::string); + bool isSensitive(const std::string &); bool isItHF(const G4VTouchable *); - bool isItEC(std::string); + bool isItEC(const std::string &); private: static const int maxSet_ = 25, maxSet2_ = 9; std::vector sensitives_, hfNames_, sensitiveEC_; std::vector hfLevels_; - bool fillHistos_, printSum_; + bool fillHistos_, printSum_, fromdd4hep_; int binEta_, binPhi_; double maxEta_, etaLow_, etaHigh_, etaLowMin_, etaLowMax_, etaMidMin_; double etaMidMax_, etaHighMin_, etaHighMax_, etaMinP_, etaMaxP_; diff --git a/Validation/Geometry/test/CMS_lumi.C b/Validation/Geometry/macros/CMS_lumi.C similarity index 100% rename from Validation/Geometry/test/CMS_lumi.C rename to Validation/Geometry/macros/CMS_lumi.C diff --git a/Validation/Geometry/test/ECALMaterialBudgetCompare.C b/Validation/Geometry/macros/ECALMaterialBudgetCompare.C similarity index 100% rename from Validation/Geometry/test/ECALMaterialBudgetCompare.C rename to Validation/Geometry/macros/ECALMaterialBudgetCompare.C diff --git a/Validation/Geometry/test/MatBudgetHcal.C b/Validation/Geometry/macros/MatBudgetHcal.C similarity index 92% rename from Validation/Geometry/test/MatBudgetHcal.C rename to Validation/Geometry/macros/MatBudgetHcal.C index cb066a3fb29e2..9dbade1a2def1 100644 --- a/Validation/Geometry/test/MatBudgetHcal.C +++ b/Validation/Geometry/macros/MatBudgetHcal.C @@ -13,6 +13,12 @@ // tag (string) Tag to be added to the name of the canvas ("Run") // debug (bool) print or not the debug information (false) // +// etaPhiPlotComp(fileName1, fileName2, plot, lay, ifEta, maxEta, tag1, +// tag2, debug) +// Make superimposed plors of integrated interaction/radiation/step +// lengths from 2 files produced through 2 sources of geometry as a +// function of eta or phi +// // etaPhiPlotHO(fileName, plot, drawLeg, ifEta, maxEta, tag) // Make the same plots as *etaPhiPlot* for HO with same parameter meanings // @@ -32,7 +38,7 @@ // the same meanings as those of *etaPhiPlot* // // etaSlicePlot(fileName, plot, ifirst, ilast, ietaRange, drawLeg, tag, debug); -// Plot phi distributions of integrated interaction/radiation/step +// Plot phi distributions of integrated interaction/radiation/step // length for a given ietaRange (0 -> 28; 1 --> 29; 2 --> 9) // // printTable(fileName, outputFileName, inputFileName) @@ -86,6 +92,15 @@ void etaPhiPlot(TString fileName = "matbdg_HCAL.root", double maxEta = -1, std::string tag = "Run", bool debug = false); +void etaPhiPlotComp(TString fileName1 = "matbdgHCAL_run3.root", + TString fileName2 = "matbdgHCAL_run3_dd4hep.root", + std::string plot = "IntLen", + int lay = 2, + bool ifEta = true, + double maxEta = -1, + std::string tag1 = "DDD", + std::string tag2 = "DD4HEP", + bool debug = false); void etaPhiPlotHO(TString fileName = "matbdg_HCAL.root", TString plot = "IntLen", int drawLeg = 1, @@ -111,13 +126,13 @@ void etaPhi2DPlot(TString fileName = "matbdg_HCAL.root", int drawLeg = 1, std::string tag = "Run"); void etaSlicePlot(TString fileName = "matbdg_HCAL.root", - TString plot = "IntLen", - int ifirst = 0, - int ilast = 19, - int ietaRange = 0, - int drawLeg = 1, - std::string tag = "Run", - bool debug = false); + TString plot = "IntLen", + int ifirst = 0, + int ilast = 19, + int ietaRange = 0, + int drawLeg = 1, + std::string tag = "Run", + bool debug = false); void etaPhi2DPlot(int nslice, int kslice, TString fileName = "matbdg_HCAL.root", @@ -255,13 +270,13 @@ void etaPhiPlot(TString fileName, double xmin = prof[0]->GetXaxis()->GetXmin(); double xmax = prof[0]->GetXaxis()->GetXmax(); double dx = (xmax - xmin) / nbinX; - cout << "Hist " << ii; + std::cout << "Hist " << ii; for (int ibx = 0; ibx < nbinX; ibx++) { double xx1 = xmin + ibx * dx; double cont = prof[0]->GetBinContent(ibx + 1); - cout << " | " << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont; + std::cout << " | " << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont; } - cout << "\n"; + std::cout << "\n"; } } @@ -279,6 +294,132 @@ void etaPhiPlot(TString fileName, leg->Draw("sames"); } +void etaPhiPlotComp(TString fileName1, + TString fileName2, + std::string plot, + int lay, + bool ifEta, + double maxEta, + std::string tag1, + std::string tag2, + bool debug) { + setStyle(); + TFile *file1 = new TFile(fileName1); + TFile *file2 = new TFile(fileName2); + if (lay < 0) + lay = 0; + else if (lay > 21) + lay = 21; + if ((file1 != nullptr) && (file2 != nullptr)) { + TDirectory *dir1 = (TDirectory *)(file1->FindObjectAny("g4SimHits")); + TDirectory *dir2 = (TDirectory *)(file2->FindObjectAny("g4SimHits")); + + TString xtit = TString("#eta"); + std::string ztit("eta"); + std::string ytit("none"); + int ymin = 0, ymax = 20, istart = 200; + double xh = 0.90; + std::string plot1("L"); + if (plot == "RadLen") { + ytit = "Radiation Length"; + ymin = 0; + ymax = 200; + istart = 100; + plot1 = "X"; + } else if (plot == "StepLen") { + ytit = "Step Length"; + ymin = 0; + ymax = 15000; + istart = 300; + xh = 0.70; + plot1 = "S"; + } else { + ytit = "Interaction Length"; + ymin = 0; + ymax = 20; + istart = 200; + } + if (!ifEta) { + istart += 400; + xtit = TString("#phi"); + ztit = "phi"; + } + double fac[23] = {0.05, 0.1, 0.3, 0.3, 0.3, 0.3, 0.3, 0.4, 0.4, 0.4, + 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.7, 0.8, 0.8, 0.9, + 1.0, 1.0, 1.0}; + ymax *= fac[lay]; + + TLegend *leg = new TLegend(xh - 0.13, 0.80, xh, 0.90); + leg->SetFillColor(kWhite); + leg->SetBorderSize(1); + leg->SetMargin(0.25); + + TProfile *prof[2]; + int color[2] = {2, 4}; + char hname[10], title[50], cname[100]; + if (lay > 1 && lay < 21) { + sprintf(title, "%s (Layer %d)", ytit.c_str(), lay-1); + } else if (lay == 1) { + sprintf(title, "%s (After Crystal)", ytit.c_str()); + } else if (lay > 20) { + sprintf(title, "%s (After HF)", ytit.c_str()); + } else { + sprintf(title, "%s (Before Crystal)", ytit.c_str()); + } + sprintf(hname, "%i", istart + lay); + dir1->GetObject(hname, prof[0]); + dir2->GetObject(hname, prof[1]); + if ((prof[0] != nullptr) && (prof[1] != nullptr)) { + for (int k = 0; k < 2; ++k) { + prof[k]->GetXaxis()->SetTitle(xtit); + prof[k]->GetYaxis()->SetTitle(title); + prof[k]->GetYaxis()->SetRangeUser(ymin, ymax); + prof[k]->SetLineColor(color[k]); + prof[k]->SetLineWidth(2); + if (ifEta && maxEta > 0) + prof[k]->GetXaxis()->SetRangeUser(-maxEta, maxEta); + if (xh < 0.8) + prof[k]->GetYaxis()->SetTitleOffset(1.7); + else + prof[k]->GetYaxis()->SetTitleOffset(1.0); + if (k == 0) + leg->AddEntry(prof[k], tag1.c_str(), "lf"); + else + leg->AddEntry(prof[k], tag2.c_str(), "lf"); + } + + sprintf (cname, "c_%sLay%d%s%s%s", plot1.c_str(), lay, ztit.c_str(), tag1.c_str(), tag2.c_str()); + TCanvas *cc1 = new TCanvas(cname, cname, 700, 600); + if (xh < 0.8) { + cc1->SetLeftMargin(0.15); + cc1->SetRightMargin(0.05); + } + + prof[0]->Draw("h"); + prof[1]->Draw("h sames"); + leg->Draw("sames"); + + if (debug) { + int nbinX = prof[0]->GetNbinsX(); + double xmin = prof[0]->GetXaxis()->GetXmin(); + double xmax = prof[0]->GetXaxis()->GetXmax(); + double dx = (xmax - xmin) / nbinX; + for (int ibx = 0; ibx < nbinX; ibx++) { + double xx1 = xmin + ibx * dx; + if (xx1 >= -1.5 && xx1 < 1.5) { + double cont1 = prof[0]->GetBinContent(ibx + 1); + double cont2 = prof[1]->GetBinContent(ibx + 1); + if ((cont1 + cont2) > 0.01) { + double frac = 2.0 * (cont1 - cont2) / (cont1 + cont2); + std::cout << ibx << "(" << xx1 << ":" << (xx1 + dx) << ") " << cont1 << ":" << cont2 << ":" << frac << std::endl; + } + } + } + } + } + } +} + void etaPhiPlotHO(TString fileName, TString plot, int drawLeg, bool ifEta, double maxEta, std::string tag) { TFile *hcalFile = new TFile(fileName); hcalFile->cd("g4SimHits"); @@ -785,8 +926,14 @@ void etaPhi2DPlot( } } -void etaSlicePlot( - TString fileName, TString plot, int ifirst, int ilast, int ietaRange, int drawLeg, std::string tag, bool debug) { +void etaSlicePlot(TString fileName, + TString plot, + int ifirst, + int ilast, + int ietaRange, + int drawLeg, + std::string tag, + bool debug) { TFile *hcalFile = new TFile(fileName); hcalFile->cd("g4SimHits"); setStyle(); diff --git a/Validation/Geometry/test/MaterialBudgetCalo.C b/Validation/Geometry/macros/MaterialBudgetCalo.C similarity index 100% rename from Validation/Geometry/test/MaterialBudgetCalo.C rename to Validation/Geometry/macros/MaterialBudgetCalo.C diff --git a/Validation/Geometry/test/MaterialBudgetMtd.C b/Validation/Geometry/macros/MaterialBudgetMtd.C similarity index 100% rename from Validation/Geometry/test/MaterialBudgetMtd.C rename to Validation/Geometry/macros/MaterialBudgetMtd.C diff --git a/Validation/Geometry/test/MaterialBudget_Maps.C b/Validation/Geometry/macros/MaterialBudget_Maps.C similarity index 100% rename from Validation/Geometry/test/MaterialBudget_Maps.C rename to Validation/Geometry/macros/MaterialBudget_Maps.C diff --git a/Validation/Geometry/test/MaterialBudget_TDR.C b/Validation/Geometry/macros/MaterialBudget_TDR.C similarity index 100% rename from Validation/Geometry/test/MaterialBudget_TDR.C rename to Validation/Geometry/macros/MaterialBudget_TDR.C diff --git a/Validation/Geometry/test/TrackerNumberingComparison.C b/Validation/Geometry/macros/TrackerNumberingComparison.C similarity index 100% rename from Validation/Geometry/test/TrackerNumberingComparison.C rename to Validation/Geometry/macros/TrackerNumberingComparison.C diff --git a/Validation/Geometry/test/tdrStyle.C b/Validation/Geometry/macros/tdrStyle.C similarity index 100% rename from Validation/Geometry/test/tdrStyle.C rename to Validation/Geometry/macros/tdrStyle.C diff --git a/Validation/Geometry/src/MaterialBudget.cc b/Validation/Geometry/src/MaterialBudget.cc index f97465d038600..1220b526609c3 100644 --- a/Validation/Geometry/src/MaterialBudget.cc +++ b/Validation/Geometry/src/MaterialBudget.cc @@ -12,9 +12,10 @@ #include "G4LogicalVolumeStore.hh" #include "G4Step.hh" #include "G4Track.hh" +#include "DD4hep/Filter.h" #include -//#define DebugLog +#define EDM_ML_DEBUG MaterialBudget::MaterialBudget(const edm::ParameterSet& p) { edm::ParameterSet m_p = p.getParameter("MaterialBudget"); @@ -62,7 +63,8 @@ void MaterialBudget::update(const BeginOfRun*) { for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) { for (unsigned int ii = 0; ii < detNames.size(); ++ii) { - if (strcmp(detNames[ii].c_str(), (*lvcite)->GetName().c_str()) == 0) { + if (strcmp(detNames[ii].c_str(), + static_cast(dd4hep::dd::noNamespace((*lvcite)->GetName())).c_str()) == 0) { logVolumes[ii] = (*lvcite); kount--; break; @@ -76,7 +78,7 @@ void MaterialBudget::update(const BeginOfRun*) { for (unsigned int ii = 0; ii < detNames.size(); ++ii) { std::string name("Unknown"); if (logVolumes[ii] != nullptr) - name = logVolumes[ii]->GetName(); + name = dd4hep::dd::noNamespace(logVolumes[ii]->GetName()); edm::LogInfo("MaterialBudget") << "LV[" << ii << "] : " << detNames[ii] << " Address " << logVolumes[ii] << " | " << name; } @@ -106,7 +108,7 @@ void MaterialBudget::update(const BeginOfTrack* trk) { phi_ = mom.phi(); stepT = 0; -#ifdef DebugLog +#ifdef EDM_ML_DEBUG double theEnergy = aTrack->GetTotalEnergy(); int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding()); edm::LogInfo("MaterialBudget") << "MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() << " Code " << theID @@ -144,8 +146,9 @@ void MaterialBudget::update(const G4Step* aStep) { stepLen[indx] = stepT; radLen[indx] += (step / radl); intLen[indx] += (step / intl); -#ifdef DebugLog - edm::LogInfo("MaterialBudget") << "MaterialBudget::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName() +#ifdef EDM_ML_DEBUG + edm::LogInfo("MaterialBudget") << "MaterialBudget::Step in " + << dd4hep::dd::noNamespace(touch->GetVolume(0)->GetLogicalVolume()->GetName()) << " Index " << indx << " Step " << step << " RadL " << step / radl << " IntL " << step / intl; #endif @@ -164,7 +167,7 @@ void MaterialBudget::update(const EndOfTrack* trk) { if (stackOrder[kk] == (int)(ii)) { radLen[jj] += radLen[kk]; intLen[jj] += intLen[kk]; -#ifdef DebugLog +#ifdef EDM_ML_DEBUG edm::LogInfo("MaterialBudget") << "MaterialBudget::Add " << kk << ":" << stackOrder[kk] << " to " << jj << ":" << stackOrder[jj] << " RadL " << radLen[kk] << " : " << radLen[jj] << " IntL " << intLen[kk] << " : " << intLen[jj] @@ -185,7 +188,7 @@ void MaterialBudget::update(const EndOfTrack* trk) { me400[ii]->Fill(phi_, radLen[ii]); me500[ii]->Fill(phi_, intLen[ii]); me600[ii]->Fill(phi_, stepLen[ii]); -#ifdef DebugLog +#ifdef EDM_ML_DEBUG std::string name("Unknown"); if (ii < detTypes.size()) name = detTypes[ii]; @@ -253,7 +256,7 @@ bool MaterialBudget::stopAfter(const G4Step* aStep) { bool flag(false); for (unsigned int ii = 0; ii < etaRegions.size(); ++ii) { -#ifdef DebugLog +#ifdef EDM_ML_DEBUG edm::LogInfo("MaterialBudget") << " MaterialBudget::Eta " << eta_ << " in Region[" << ii << "] with " << etaRegions[ii] << " type " << regionTypes[ii] << "|" << boundaries[ii]; #endif @@ -265,14 +268,14 @@ bool MaterialBudget::stopAfter(const G4Step* aStep) { if (zz >= boundaries[ii] - 0.001) flag = true; } -#ifdef DebugLog +#ifdef EDM_ML_DEBUG if (flag) edm::LogInfo("MaterialBudget") << " MaterialBudget::Stop after R = " << rr << " and Z = " << zz; #endif break; } } -#ifdef DebugLog +#ifdef EDM_ML_DEBUG edm::LogInfo("MaterialBudget") << " MaterialBudget:: R = " << rr << " and Z = " << zz << " Flag " << flag; #endif return flag; diff --git a/Validation/Geometry/src/MaterialBudgetAction.cc b/Validation/Geometry/src/MaterialBudgetAction.cc index abdbe168d02e3..895186500baec 100644 --- a/Validation/Geometry/src/MaterialBudgetAction.cc +++ b/Validation/Geometry/src/MaterialBudgetAction.cc @@ -25,6 +25,7 @@ #include "G4ParticleDefinition.hh" #include "G4ProcessManager.hh" #include "G4TransportationManager.hh" +#include "DD4hep/Filter.h" #include @@ -38,25 +39,25 @@ MaterialBudgetAction::MaterialBudgetAction(const edm::ParameterSet& iPSet) { std::string theHistoList = m_Anal.getParameter("HistogramList"); std::vector volList = m_Anal.getParameter >("SelectedVolumes"); - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: List of the selected volumes:"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: List of the selected volumes:"; for (const auto& it : volList) { if (it != "None") { theVolumeList.push_back(it); - edm::LogInfo("MaterialBudget") << it; + edm::LogVerbatim("MaterialBudget") << it; } } // log if (theHistoList == "Tracker") { - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: running in Tracker Mode"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: running in Tracker Mode"; } else if (theHistoList == "ECAL") { - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: running in Ecal Mode"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: running in Ecal Mode"; } else if (theHistoList == "Mtd") { - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: running in Mtd Mode"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: running in Mtd Mode"; } else if (theHistoList == "HGCal") { - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: running in HGCal Mode"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: running in HGCal Mode"; } else { - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: running in General Mode"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: running in General Mode"; } //---- Stop track when a process occurs @@ -67,7 +68,7 @@ MaterialBudgetAction::MaterialBudgetAction(const edm::ParameterSet& iPSet) { std::string saveToHistosFile = m_Anal.getParameter("HistosFile"); if (saveToHistosFile != "None") { saveToHistos = true; - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: saving histograms to " << saveToHistosFile; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: saving histograms to " << saveToHistosFile; theHistoMgr = std::make_shared(); if (theHistoList == "Tracker") { theHistos = std::make_shared(theData, theHistoMgr, saveToHistosFile); @@ -109,7 +110,7 @@ MaterialBudgetAction::MaterialBudgetAction(const edm::ParameterSet& iPSet) { std::string saveToTxtFile = m_Anal.getParameter("TextFile"); if (saveToTxtFile != "None") { saveToTxt = true; - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: saving text info to " << saveToTxtFile; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: saving text info to " << saveToTxtFile; theTxt = std::make_shared(theData, saveToTxtFile); } else { saveToTxt = false; @@ -117,7 +118,7 @@ MaterialBudgetAction::MaterialBudgetAction(const edm::ParameterSet& iPSet) { //---- Compute all the steps even if not stored on file bool allSteps = m_Anal.getParameter("AllStepsToTree"); - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: all steps are computed " << allSteps; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: all steps are computed " << allSteps; if (allSteps) theData->SetAllStepsToTree(); @@ -129,14 +130,14 @@ MaterialBudgetAction::MaterialBudgetAction(const edm::ParameterSet& iPSet) { } else { saveToTree = false; } - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: saving ROOT TTree to " << saveToTreeFile; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: saving ROOT TTree to " << saveToTreeFile; //---- Track the first decay products of the main particle // if their kinetic energy is greater than Ekin storeDecay = m_Anal.getUntrackedParameter("storeDecay", false); Ekin = m_Anal.getUntrackedParameter("EminDecayProd", 1000.0); // MeV - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction: decay products steps are stored (" << storeDecay - << ") if their kinetic energy is greater than " << Ekin << " MeV"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction: decay products steps are stored (" << storeDecay + << ") if their kinetic energy is greater than " << Ekin << " MeV"; firstParticle = false; } @@ -151,7 +152,7 @@ void MaterialBudgetAction::update(const BeginOfRun*) { for (const auto& volcite : theVolumeList) { bool volFound = false; for (const auto& lvcite : *lvs) { - if (lvcite->GetName() == volcite) { + if (static_cast(dd4hep::dd::noNamespace(lvcite->GetName())) == static_cast(volcite)) { volFound = true; break; } @@ -274,7 +275,7 @@ std::string MaterialBudgetAction::getSubDetectorName(G4StepPoint* aStepPoint) { G4int num_levels = theTouchable->GetHistoryDepth(); if (theTouchable->GetVolume()) { - return theTouchable->GetVolume(num_levels - 1)->GetName(); + return static_cast(dd4hep::dd::noNamespace(theTouchable->GetVolume(num_levels - 1)->GetName())); } else { return "OutOfWorld"; } @@ -286,7 +287,7 @@ std::string MaterialBudgetAction::getPartName(G4StepPoint* aStepPoint) { G4int num_levels = theTouchable->GetHistoryDepth(); if (theTouchable->GetVolume()) { - return theTouchable->GetVolume(num_levels - 3)->GetName(); + return static_cast(dd4hep::dd::noNamespace(theTouchable->GetVolume(num_levels - 3)->GetName())); } else { return "OutOfWorld"; } @@ -324,7 +325,8 @@ void MaterialBudgetAction::update(const EndOfRun*) { bool MaterialBudgetAction::CheckTouchableInSelectedVolumes(const G4VTouchable* touch) { size_t volh = touch->GetHistoryDepth(); for (int ii = volh; ii >= 0; ii--) { - if (std::find(theVolumeList.begin(), theVolumeList.end(), touch->GetVolume(ii)->GetName()) != theVolumeList.end()) + G4String name = static_cast(dd4hep::dd::noNamespace(touch->GetVolume(ii)->GetName())); + if (std::find(theVolumeList.begin(), theVolumeList.end(), name) != theVolumeList.end()) return true; } return false; @@ -338,8 +340,8 @@ bool MaterialBudgetAction::StopAfterProcess(const G4Step* aStep) { if (aStep->GetPostStepPoint()->GetProcessDefinedStep() == nullptr) return false; if (aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == theProcessToStop) { - edm::LogInfo("MaterialBudget") << "MaterialBudgetAction :" - << aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetAction :" + << aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); return true; } else { return false; diff --git a/Validation/Geometry/src/MaterialBudgetData.cc b/Validation/Geometry/src/MaterialBudgetData.cc index 077dc241ec1e5..bb3897f2d0074 100644 --- a/Validation/Geometry/src/MaterialBudgetData.cc +++ b/Validation/Geometry/src/MaterialBudgetData.cc @@ -4,6 +4,7 @@ #include "G4Material.hh" #include "G4EventManager.hh" #include "G4Event.hh" +#include "DD4hep/Filter.h" MaterialBudgetData::MaterialBudgetData() { //instantiate categorizer to assign an ID to volumes and materials @@ -193,12 +194,13 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { G4double intlen = theMaterialPre->GetNuclearInterLength(); G4double density = theMaterialPre->GetDensity() / densityConvertionFactor; // always g/cm3 - G4String materialName = theMaterialPre->GetName(); + G4String materialName = static_cast(dd4hep::dd::noNamespace(theMaterialPre->GetName())); LogDebug("MaterialBudget") << "MaterialBudgetData: Material " << materialName << " steplen " << steplen << " radlen " << radlen << " mb " << steplen / radlen; - G4String volumeName = aStep->GetPreStepPoint()->GetTouchable()->GetVolume(0)->GetLogicalVolume()->GetName(); + G4String volumeName = static_cast( + dd4hep::dd::noNamespace(aStep->GetPreStepPoint()->GetTouchable()->GetVolume(0)->GetLogicalVolume()->GetName())); LogDebug("MaterialBudget") << "MaterialBudgetData: Volume " << volumeName << " Material " << materialName; @@ -225,8 +227,8 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { } else { theOtherFractionMB = 1.f; theOtherFractionIL = 1.f; - edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material forced to 'Other': " << materialName - << " in volume " << volumeName << ". Check Categorization."; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetData: Material forced to 'Other': " << materialName + << " in volume " << volumeName << ". Check Categorization."; } } else { theSupportFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[0]; @@ -238,7 +240,7 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { theAirFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[6]; if (theOtherFractionMB > 0.f) - edm::LogWarning("MaterialBudget") + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName << " in volume " << volumeName; theSupportFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[0]; @@ -250,7 +252,7 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { theAirFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[6]; if (theOtherFractionIL > 0.f) - edm::LogWarning("MaterialBudget") + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName << " in volume " << volumeName; } } else { // isHGCal @@ -262,8 +264,8 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { theOtherFractionMB = 1.f; theOtherFractionIL = 1.f; - edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material forced to 'Other': " << materialName - << " in volume " << volumeName; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetData: Material forced to 'Other': " << materialName + << " in volume " << volumeName; } else { theAirFractionMB = myMaterialBudgetCategorizer->HGCalx0fraction(materialName)[0]; theCablesFractionMB = myMaterialBudgetCategorizer->HGCalx0fraction(materialName)[1]; @@ -280,7 +282,7 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { theAluminiumFractionMB = myMaterialBudgetCategorizer->HGCalx0fraction(materialName)[12]; if (theOtherFractionMB != 0) - // edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName + // edm::LogVerbatim("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName // << " in volume " << volumeName << std::endl; std::cout << "MaterialBudgetData: Material found with no category: " << materialName << " in volume " << volumeName << std::endl; @@ -300,8 +302,8 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { theAluminiumFractionIL = myMaterialBudgetCategorizer->HGCall0fraction(materialName)[12]; if (theOtherFractionIL != 0) - edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category " << materialName - << " in volume " << volumeName << std::endl; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetData: Material found with no category " << materialName + << " in volume " << volumeName << std::endl; } } @@ -488,7 +490,7 @@ void MaterialBudgetData::dataPerStep(const G4Step* aStep) { } theTrkLen = aStep->GetTrack()->GetTrackLength(); - thePVname = pv->GetName(); + thePVname = static_cast(dd4hep::dd::noNamespace(pv->GetName())); thePVcopyNo = pv->GetCopyNo(); theRadLen = radlen; theIntLen = intlen; diff --git a/Validation/Geometry/src/MaterialBudgetEcalHistos.cc b/Validation/Geometry/src/MaterialBudgetEcalHistos.cc index 106d7e86ed943..8ba2c6c99df11 100644 --- a/Validation/Geometry/src/MaterialBudgetEcalHistos.cc +++ b/Validation/Geometry/src/MaterialBudgetEcalHistos.cc @@ -12,7 +12,7 @@ MaterialBudgetEcalHistos::MaterialBudgetEcalHistos(std::shared_ptraddHistoProf1(new TProfile("10", "MB prof Eta ", 250, -5., 5.)); @@ -94,7 +94,7 @@ void MaterialBudgetEcalHistos::book() { hmgr->addHistoProf1(new TProfile("1013", "MB prof Eta ECAL Preshower -", 100, -2.6, -1.65)); hmgr->addHistoProf1(new TProfile("1014", "MB prof Phi ECAL Preshower -", 180, -3.1416, 3.1416)); - edm::LogInfo("MaterialBudget") << "MaterialBudgetEcalHistos: booking user histos done"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetEcalHistos: booking user histos done"; } void MaterialBudgetEcalHistos::fillStartTrack() {} @@ -146,6 +146,6 @@ void MaterialBudgetEcalHistos::fillEndTrack() { } void MaterialBudgetEcalHistos::endOfRun() { - edm::LogInfo("MaterialBudget") << "MaterialBudgetEcalHistos: Writing histos ROOT file to:" << theFileName; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetEcalHistos: Writing histos ROOT file to:" << theFileName; hmgr->save(theFileName); } diff --git a/Validation/Geometry/src/MaterialBudgetHcalHistos.cc b/Validation/Geometry/src/MaterialBudgetHcalHistos.cc index fa8858838a1ee..844884ea5b2d6 100644 --- a/Validation/Geometry/src/MaterialBudgetHcalHistos.cc +++ b/Validation/Geometry/src/MaterialBudgetHcalHistos.cc @@ -25,6 +25,7 @@ MaterialBudgetHcalHistos::MaterialBudgetHcalHistos(const edm::ParameterSet& p) { etaHigh_ = p.getUntrackedParameter("EtaHigh", 5.2); fillHistos_ = p.getUntrackedParameter("FillHisto", true); printSum_ = p.getUntrackedParameter("PrintSummary", false); + fromdd4hep_ = p.getUntrackedParameter("Fromdd4hep", false); etaMinP_ = p.getUntrackedParameter("EtaMinP", 5.2); etaMaxP_ = p.getUntrackedParameter("EtaMaxP", 0.0); etaLowMin_ = p.getUntrackedParameter("EtaLowMin", 0.783); @@ -39,7 +40,8 @@ MaterialBudgetHcalHistos::MaterialBudgetHcalHistos(const edm::ParameterSet& p) { << " (Eta limit " << etaLow_ << ":" << etaHigh_ << ")" << " Eta range (" << etaLowMin_ << ":" << etaLowMax_ << "), (" << etaMidMin_ << ":" << etaMidMax_ << "), (" << etaHighMin_ << ":" << etaHighMax_ - << ") Debug for eta range " << etaMinP_ << ":" << etaMaxP_; + << ") Debug for eta range " << etaMinP_ << ":" << etaMaxP_ << " FromDD4Hep " + << fromdd4hep_; if (fillHistos_) book(); } @@ -51,7 +53,12 @@ void MaterialBudgetHcalHistos::fillBeginJob(const DDCompactView& cpv) { std::string value = "HcalHits"; DDSpecificsMatchesValueFilter filter1{DDValue(attribute, value, 0)}; DDFilteredView fv1(cpv, filter1); - sensitives_ = getNames(fv1); + std::vector names = getNames(fv1); + for (auto& name : names) { + std::string namx = (name.find('_') == std::string::npos) ? name : name.substr(0, name.find('_')); + if (std::find(sensitives_.begin(), sensitives_.end(), namx) == sensitives_.end()) + sensitives_.emplace_back(namx); + } edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = " << value << " has " << sensitives_.size() << " elements"; for (unsigned int i = 0; i < sensitives_.size(); i++) @@ -83,8 +90,11 @@ void MaterialBudgetHcalHistos::fillBeginJob(const DDCompactView& cpv) { std::vector senstmp = getNames(fv3); edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = " << value << " has " << senstmp.size() << " elements"; - for (unsigned int i = 0; i < senstmp.size(); i++) - sensitiveEC_.push_back(senstmp[i]); + for (unsigned int i = 0; i < senstmp.size(); i++) { + std::string name = senstmp[i].substr(0, 4); + if (std::find(sensitiveEC_.begin(), sensitiveEC_.end(), name) == sensitiveEC_.end()) + sensitiveEC_.push_back(name); + } } for (unsigned int i = 0; i < sensitiveEC_.size(); i++) edm::LogVerbatim("MaterialBudgetFull") @@ -99,7 +109,12 @@ void MaterialBudgetHcalHistos::fillBeginJob(const cms::DDCompactView& cpv) { std::string value = "HcalHits"; const cms::DDFilter filter1(attribute, value); cms::DDFilteredView fv1(cpv, filter1); - sensitives_ = getNames(fv1); + std::vector names = getNames(fv1); + for (auto& name : names) { + std::string namx = (name.find('_') == std::string::npos) ? name : name.substr(0, name.find('_')); + if (std::find(sensitives_.begin(), sensitives_.end(), namx) == sensitives_.end()) + sensitives_.emplace_back(namx); + } edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = " << value << " has " << sensitives_.size() << " elements"; for (unsigned int i = 0; i < sensitives_.size(); i++) @@ -128,8 +143,11 @@ void MaterialBudgetHcalHistos::fillBeginJob(const cms::DDCompactView& cpv) { std::vector senstmp = getNames(fv); edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = " << value << " has " << senstmp.size() << " elements"; - for (unsigned int i = 0; i < senstmp.size(); i++) - sensitiveEC_.push_back(senstmp[i]); + for (unsigned int i = 0; i < senstmp.size(); i++) { + std::string name = senstmp[i].substr(0, 4); + if (std::find(sensitiveEC_.begin(), sensitiveEC_.end(), name) == sensitiveEC_.end()) + sensitiveEC_.push_back(name); + } } for (unsigned int i = 0; i < sensitiveEC_.size(); i++) edm::LogVerbatim("MaterialBudgetFull") @@ -214,6 +232,12 @@ void MaterialBudgetHcalHistos::fillPerStep(const G4Step* aStep) { int det = 0, lay = 0; double abseta = std::abs(eta_); if (fillHistos_) { + edm::LogVerbatim("MaterialBudgetFull") + << "Volume " << name << ":" << matName << " EC:Sensitive:HF " << isItEC(name) << ":" << isSensitive(name) << ":" + << isItHF(touch) << " Eta " << abseta << " HC " << ((touch->GetReplicaNumber(1)) / 1000) << ":" + << ((touch->GetReplicaNumber(0) / 10) % 100 + 3) << " X0 " << (radLen_ + (step / radl)) << " Lambda " + << (intLen_ + (step / intl)); + ; if (isItEC(name)) { det = 1; lay = 1; @@ -546,18 +570,8 @@ std::vector MaterialBudgetHcalHistos::getNames(DDFilteredView& fv) std::vector MaterialBudgetHcalHistos::getNames(cms::DDFilteredView& fv) { std::vector tmp; - const std::vector notIn = {"CALO", - "HCal", - "MBBTL", - "MBBTR", - "MBBTC", - "MBAT", - "MBBT_R1M", - "MBBT_R1P", - "MBBT_R1MX", - "MBBT_R1PX", - "VCAL", - "HVQF"}; + const std::vector notIn = { + "CALO", "HCal", "MBBTL", "MBBTR", "MBBTC", "MBAT", "MBBT_R1M", "MBBT_R1P", "MBBT_R1MX", "MBBT_R1PX", "VCAL"}; while (fv.firstChild()) { const std::string n{fv.name().data(), fv.name().size()}; if (std::find(notIn.begin(), notIn.end(), n) == notIn.end()) { @@ -587,11 +601,12 @@ std::vector MaterialBudgetHcalHistos::getDDDArray(const std::string& str } } -bool MaterialBudgetHcalHistos::isSensitive(std::string name) { +bool MaterialBudgetHcalHistos::isSensitive(const std::string& name) { std::vector::const_iterator it = sensitives_.begin(); std::vector::const_iterator itEnd = sensitives_.end(); + std::string namx = (name.find('_') == std::string::npos) ? name : name.substr(0, name.find('_')); for (; it != itEnd; ++it) - if (name == *it) + if (namx == *it) return true; return false; } @@ -601,7 +616,8 @@ bool MaterialBudgetHcalHistos::isItHF(const G4VTouchable* touch) { for (unsigned int it = 0; it < hfNames_.size(); it++) { if (levels >= hfLevels_[it]) { std::string name = - (static_cast(dd4hep::dd::noNamespace(touch->GetVolume(levels - hfLevels_[it])->GetName()))); + (static_cast(dd4hep::dd::noNamespace(touch->GetVolume(levels - hfLevels_[it])->GetName()))) + .substr(0, 4); if (name == hfNames_[it]) { return true; } @@ -610,11 +626,11 @@ bool MaterialBudgetHcalHistos::isItHF(const G4VTouchable* touch) { return false; } -bool MaterialBudgetHcalHistos::isItEC(std::string name) { +bool MaterialBudgetHcalHistos::isItEC(const std::string& name) { std::vector::const_iterator it = sensitiveEC_.begin(); std::vector::const_iterator itEnd = sensitiveEC_.end(); for (; it != itEnd; ++it) - if (name == *it) + if (name.substr(0, 4) == *it) return true; return false; } diff --git a/Validation/Geometry/test/runP_ECAL_cfg.py b/Validation/Geometry/test/runP_ECAL_cfg.py index 443f817f120e2..7be39336340fa 100644 --- a/Validation/Geometry/test/runP_ECAL_cfg.py +++ b/Validation/Geometry/test/runP_ECAL_cfg.py @@ -1,18 +1,17 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("PROD") +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PROD',Run3) process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") #Geometry # -process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi") - -process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") +process.load("Configuration.Geometry.GeometryExtended2021_cff") #Magnetic Field # -process.load("Configuration.StandardSequences.MagneticField_38T_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") # Output of events, etc... # @@ -25,20 +24,9 @@ process.load("IOMC.RandomEngine.IOMC_cff") process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - FwkJob = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - default = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True) - ) -) +process.load('FWCore.MessageService.MessageLogger_cfi') +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.MaterialBudget=dict() process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring('file:single_neutrino_random.root') @@ -57,14 +45,14 @@ process.g4SimHits.Watchers = cms.VPSet(cms.PSet( type = cms.string('MaterialBudgetAction'), MaterialBudgetAction = cms.PSet( - HistosFile = cms.string('matbdg_ECAL.root'), + HistosFile = cms.string('matbdg_ECAL_DDD.root'), AllStepsToTree = cms.bool(False), HistogramList = cms.string('ECAL'), SelectedVolumes = cms.vstring('ECAL'), # string TextFile = "None" # "None" means this option TreeFile = cms.string('None'), StopAfterProcess = cms.string('None'), - TextFile = cms.string('matbdg_ECAL.txt') + TextFile = cms.string('matbdg_ECAL_DDD.txt') ) )) diff --git a/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py b/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py new file mode 100644 index 0000000000000..6136845c97cde --- /dev/null +++ b/Validation/Geometry/test/runP_ECAL_dd4hep_cfg.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +process = cms.Process('PROD',Run3_dd4hep) + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") + +#Geometry +# +process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') + +#Magnetic Field +# +process.load("Configuration.StandardSequences.MagneticField_cff") + +# Output of events, etc... +# +# Explicit note : since some histos/tree might be dumped directly, +# better NOT use PoolOutputModule ! +# Detector simulation (Geant4-based) +# +process.load("SimG4Core.Application.g4SimHits_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.p1 = cms.Path(process.g4SimHits) +process.g4SimHits.UseMagneticField = False +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + type = cms.string('MaterialBudgetAction'), + MaterialBudgetAction = cms.PSet( + HistosFile = cms.string('matbdg_ECAL_DD4HEP.root'), + AllStepsToTree = cms.bool(False), + HistogramList = cms.string('ECAL'), + SelectedVolumes = cms.vstring('ECAL'), + # string TextFile = "None" # "None" means this option + TreeFile = cms.string('None'), + StopAfterProcess = cms.string('None'), + TextFile = cms.string('matbdg_ECAL_DD4HEP.txt') + ) +)) + + diff --git a/Validation/Geometry/test/runP_HCAL_cfg.py b/Validation/Geometry/test/runP_HCAL_cfg.py index 41405befca4bb..529f1a0d95425 100644 --- a/Validation/Geometry/test/runP_HCAL_cfg.py +++ b/Validation/Geometry/test/runP_HCAL_cfg.py @@ -12,6 +12,7 @@ process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(10000) if hasattr(process,'MessageLogger'): process.MessageLogger.MaterialBudget=dict() diff --git a/Validation/Geometry/test/runP_HCAL_dd4hep_cfg.py b/Validation/Geometry/test/runP_HCAL_dd4hep_cfg.py new file mode 100644 index 0000000000000..fda7cd3cacefb --- /dev/null +++ b/Validation/Geometry/test/runP_HCAL_dd4hep_cfg.py @@ -0,0 +1,64 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +process = cms.Process('PROD',Run3_dd4hep) + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("SimG4Core.Application.g4SimHits_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(10000) +if hasattr(process,'MessageLogger'): + process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + noEventSort = cms.untracked.bool(True), + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('matbdgHCAL_run3_dd4hep.root') +) + +process.p1 = cms.Path(process.g4SimHits) +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + MaterialBudgetHcal = cms.PSet( + FillHisto = cms.untracked.bool(True), + PrintSummary = cms.untracked.bool(True), + DoHCAL = cms.untracked.bool(True), + NBinPhi = cms.untracked.int32(180), + NBinEta = cms.untracked.int32(260), + MaxEta = cms.untracked.double(5.2), + EtaLow = cms.untracked.double(-5.2), + EtaHigh = cms.untracked.double(5.2), + EtaMinP = cms.untracked.double(5.2), + EtaMaxP = cms.untracked.double(0.0), + EtaLowMin = cms.untracked.double(0.783), + EtaLowMax = cms.untracked.double(0.870), + EtaMidMin = cms.untracked.double(2.650), + EtaMidMax = cms.untracked.double(2.868), + EtaHighMin = cms.untracked.double(2.868), + EtaHighMax = cms.untracked.double(3.000), + RMax = cms.untracked.double(5.0), + ZMax = cms.untracked.double(14.0), + Fromdd4hep = cms.untracked.bool(True) + ), + type = cms.string('MaterialBudgetHcal') +)) + + diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index 2e603edcc6a98..f617830125c1d 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -60,6 +60,7 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { std::unordered_map const&) const; protected: + edm::ESGetToken caloGeomToken_; edm::InputTag label_lcl; std::vector label_mcl; edm::InputTag associator_; @@ -67,9 +68,9 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { const bool SaveGeneralInfo_; const bool doCaloParticlePlots_; const bool doCaloParticleSelection_; - const bool dosimclustersPlots_; - const bool dolayerclustersPlots_; - const bool domulticlustersPlots_; + const bool doSimClustersPlots_; + const bool doLayerClustersPlots_; + const bool doMultiClustersPlots_; std::vector label_clustersmask; const edm::FileInPath cummatbudinxo_; diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index a25a1f0d4eb64..f6359fd9294b1 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -149,6 +149,7 @@ struct HGVHistoProducerAlgoHistograms { std::vector h_numMerge_multicl_phi; std::vector h_sharedenergy_multicl2caloparticle; std::vector h_sharedenergy_caloparticle2multicl; + std::vector h_sharedenergy_caloparticle2multicl_assoc; std::vector h_sharedenergy_multicl2caloparticle_vs_eta; std::vector h_sharedenergy_multicl2caloparticle_vs_phi; std::vector h_sharedenergy_caloparticle2multicl_vs_eta; diff --git a/Validation/HGCalValidation/plugins/BuildFile.xml b/Validation/HGCalValidation/plugins/BuildFile.xml index 2b68d43e229db..8a5f230cae0e2 100644 --- a/Validation/HGCalValidation/plugins/BuildFile.xml +++ b/Validation/HGCalValidation/plugins/BuildFile.xml @@ -19,8 +19,6 @@ - - @@ -32,7 +30,6 @@ - diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index 3bc004f7df673..e662bd1ff7b32 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -9,16 +9,17 @@ using namespace std; using namespace edm; HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) - : label_lcl(pset.getParameter("label_lcl")), + : caloGeomToken_(esConsumes()), + label_lcl(pset.getParameter("label_lcl")), label_mcl(pset.getParameter>("label_mcl")), associator_(pset.getUntrackedParameter("associator")), associatorSim_(pset.getUntrackedParameter("associatorSim")), SaveGeneralInfo_(pset.getUntrackedParameter("SaveGeneralInfo")), doCaloParticlePlots_(pset.getUntrackedParameter("doCaloParticlePlots")), doCaloParticleSelection_(pset.getUntrackedParameter("doCaloParticleSelection")), - dosimclustersPlots_(pset.getUntrackedParameter("dosimclustersPlots")), - dolayerclustersPlots_(pset.getUntrackedParameter("dolayerclustersPlots")), - domulticlustersPlots_(pset.getUntrackedParameter("domulticlustersPlots")), + doSimClustersPlots_(pset.getUntrackedParameter("doSimClustersPlots")), + doLayerClustersPlots_(pset.getUntrackedParameter("doLayerClustersPlots")), + doMultiClustersPlots_(pset.getUntrackedParameter("doMultiClustersPlots")), label_clustersmask(pset.getParameter>("LayerClustersInputMask")), cummatbudinxo_(pset.getParameter("cummatbudinxo")) { //In this way we can easily generalize to associations between other objects also. @@ -115,7 +116,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, } //Booking histograms concerning with simclusters - if (dosimclustersPlots_) { + if (doSimClustersPlots_) { ibook.cd(); ibook.setCurrentFolder(dirName_ + "simClusters/ClusterLevel"); histoProducerAlgo_->bookSimClusterHistos( @@ -149,7 +150,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, } //if for simcluster plots //Booking histograms concerning with hgcal layer clusters - if (dolayerclustersPlots_) { + if (doLayerClustersPlots_) { ibook.cd(); ibook.setCurrentFolder(dirName_ + "hgcalLayerClusters/ClusterLevel"); histoProducerAlgo_->bookClusterHistos_ClusterLevel(ibook, @@ -192,7 +193,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook.setCurrentFolder(dirName); //Booking histograms concerning for hgcal multi clusters - if (domulticlustersPlots_) { + if (doMultiClustersPlots_) { histoProducerAlgo_->bookMultiClusterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); } } //end of booking multiclusters loop @@ -241,8 +242,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(label_cp_effic, caloParticleHandle); std::vector const& caloParticles = *caloParticleHandle; - edm::ESHandle geom; - setup.get().get(geom); + edm::ESHandle geom = setup.getHandle(caloGeomToken_); tools_->setGeometry(*geom); histoProducerAlgo_->setRecHitTools(tools_); @@ -310,7 +310,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, // ############################################## // fill simcluster histograms // ############################################## - if (dosimclustersPlots_) { + if (doSimClustersPlots_) { histoProducerAlgo_->fill_simcluster_histos( histograms.histoProducerAlgo, simclusters, totallayers_to_monitor_, thicknesses_to_monitor_); @@ -347,7 +347,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, // fill layercluster histograms // ############################################## int w = 0; //counter counting the number of sets of histograms - if (dolayerclustersPlots_) { + if (doLayerClustersPlots_) { histoProducerAlgo_->fill_generic_cluster_histos(histograms.histoProducerAlgo, w, clusterHandle, @@ -377,7 +377,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, // fill multicluster histograms // ############################################## for (unsigned int wml = 0; wml < label_mclTokens.size(); wml++) { - if (domulticlustersPlots_) { + if (doMultiClustersPlots_) { edm::Handle> multiClusterHandle; event.getByToken(label_mclTokens[wml], multiClusterHandle); const std::vector& multiClusters = *multiClusterHandle; diff --git a/Validation/HGCalValidation/plugins/TICLTrackstersEdgesValidation.cc b/Validation/HGCalValidation/plugins/TICLTrackstersEdgesValidation.cc new file mode 100644 index 0000000000000..792808e343161 --- /dev/null +++ b/Validation/HGCalValidation/plugins/TICLTrackstersEdgesValidation.cc @@ -0,0 +1,329 @@ +#include +#include +#include + +// user include files +#include "DataFormats/Math/interface/Point3D.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Utilities/interface/transform.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" +#include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h" + +#include "DataFormats/CaloRecHit/interface/CaloCluster.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +using namespace ticl; + +struct Histogram_TICLTrackstersEdgesValidation { + dqm::reco::MonitorElement* number_; + dqm::reco::MonitorElement *raw_energy_, *raw_energy_1plusLC_; + dqm::reco::MonitorElement *regr_energy_, *regr_energy_1plusLC_; + dqm::reco::MonitorElement *raw_energy_vs_regr_energy_, *raw_energy_vs_regr_energy_1plusLC_; + dqm::reco::MonitorElement *id_prob_, *id_prob_1plusLC_; + dqm::reco::MonitorElement* delta_energy_; + dqm::reco::MonitorElement* delta_energy_relative_; + dqm::reco::MonitorElement* delta_energy_vs_energy_; + dqm::reco::MonitorElement* delta_energy_vs_layer_; + dqm::reco::MonitorElement* delta_energy_relative_vs_layer_; + dqm::reco::MonitorElement* delta_layer_; + dqm::reco::MonitorElement* ingoing_links_vs_layer_; + dqm::reco::MonitorElement* outgoing_links_vs_layer_; + // For the definition of the angles, read http://hgcal.web.cern.ch/hgcal/Reconstruction/Tutorial/ + dqm::reco::MonitorElement* angle_alpha_; + dqm::reco::MonitorElement* angle_alpha_alternative_; + dqm::reco::MonitorElement* angle_beta_; + std::vector angle_beta_byLayer_; + std::vector angle_beta_w_byLayer_; +}; + +using Histograms_TICLTrackstersEdgesValidation = + std::unordered_map; + +class TICLTrackstersEdgesValidation : public DQMGlobalEDAnalyzer { +public: + explicit TICLTrackstersEdgesValidation(const edm::ParameterSet&); + ~TICLTrackstersEdgesValidation() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void bookHistograms(DQMStore::IBooker&, + edm::Run const&, + edm::EventSetup const&, + Histograms_TICLTrackstersEdgesValidation&) const override; + + void dqmAnalyze(edm::Event const&, + edm::EventSetup const&, + Histograms_TICLTrackstersEdgesValidation const&) const override; + void dqmBeginRun(edm::Run const&, edm::EventSetup const&, Histograms_TICLTrackstersEdgesValidation&) const override; + + edm::ESGetToken caloGeomToken_; + std::string folder_; + std::vector trackstersCollectionsNames_; + std::vector>> tracksterTokens_; + edm::EDGetTokenT> layerClustersToken_; + edm::EDGetTokenT> ticlSeedingGlobalToken_; + edm::EDGetTokenT> ticlSeedingTrkToken_; + mutable hgcal::RecHitTools rhtools_; +}; + +TICLTrackstersEdgesValidation::TICLTrackstersEdgesValidation(const edm::ParameterSet& iConfig) + : caloGeomToken_(esConsumes()), + folder_(iConfig.getParameter("folder")) { + tracksterTokens_ = edm::vector_transform(iConfig.getParameter>("tracksterCollections"), + [this](edm::InputTag const& tag) { + trackstersCollectionsNames_.emplace_back(tag.label()); + return consumes>(tag); + }); + layerClustersToken_ = consumes>(iConfig.getParameter("layerClusters")); + ticlSeedingGlobalToken_ = + consumes>(iConfig.getParameter("ticlSeedingGlobal")); + ticlSeedingTrkToken_ = + consumes>(iConfig.getParameter("ticlSeedingTrk")); +} + +TICLTrackstersEdgesValidation::~TICLTrackstersEdgesValidation() {} + +void TICLTrackstersEdgesValidation::dqmAnalyze(edm::Event const& iEvent, + edm::EventSetup const& iSetup, + Histograms_TICLTrackstersEdgesValidation const& histos) const { + edm::Handle> layerClustersH; + iEvent.getByToken(layerClustersToken_, layerClustersH); + auto const& layerClusters = *layerClustersH.product(); + + edm::Handle> ticlSeedingGlobalH; + iEvent.getByToken(ticlSeedingGlobalToken_, ticlSeedingGlobalH); + auto const& ticlSeedingGlobal = *ticlSeedingGlobalH.product(); + + edm::Handle> ticlSeedingTrkH; + iEvent.getByToken(ticlSeedingTrkToken_, ticlSeedingTrkH); + auto const& ticlSeedingTrk = *ticlSeedingTrkH.product(); + + for (const auto& trackster_token : tracksterTokens_) { + edm::Handle> trackster_h; + iEvent.getByToken(trackster_token, trackster_h); + auto numberOfTracksters = trackster_h->size(); + //using .at() as [] is not const + const auto& histo = histos.at(trackster_token.index()); + histo.number_->Fill(numberOfTracksters); + for (unsigned int i = 0; i < numberOfTracksters; ++i) { + const auto& thisTrackster = trackster_h->at(i); + + // The following plots should be moved to HGVHistoProducerAlgo + // when we get rid of the MultiClusters and use only Tracksters + histo.raw_energy_->Fill(thisTrackster.raw_energy()); + histo.regr_energy_->Fill(thisTrackster.regressed_energy()); + histo.raw_energy_vs_regr_energy_->Fill(thisTrackster.regressed_energy(), thisTrackster.raw_energy()); + const auto& probs = thisTrackster.id_probabilities(); + std::vector sorted_probs_idx(probs.size()); + std::iota(begin(sorted_probs_idx), end(sorted_probs_idx), 0); + std::sort(begin(sorted_probs_idx), end(sorted_probs_idx), [&probs](int i, int j) { return probs[i] > probs[j]; }); + histo.id_prob_->Fill(sorted_probs_idx[0]); + if (!thisTrackster.vertices().empty()) { + histo.raw_energy_1plusLC_->Fill(thisTrackster.raw_energy()); + histo.regr_energy_1plusLC_->Fill(thisTrackster.regressed_energy()); + histo.raw_energy_vs_regr_energy_1plusLC_->Fill(thisTrackster.regressed_energy(), thisTrackster.raw_energy()); + histo.id_prob_1plusLC_->Fill(sorted_probs_idx[0]); + } + + // Plots on edges + for (const auto& edge : thisTrackster.edges()) { + auto& ic = layerClusters[edge[0]]; + auto& oc = layerClusters[edge[1]]; + auto const& cl_in = ic.hitsAndFractions()[0].first; + auto const& cl_out = oc.hitsAndFractions()[0].first; + auto const layer_in = rhtools_.getLayerWithOffset(cl_in); + auto const layer_out = rhtools_.getLayerWithOffset(cl_out); + histo.delta_energy_->Fill(oc.energy() - ic.energy()); + histo.delta_energy_relative_->Fill((oc.energy() - ic.energy()) / ic.energy()); + histo.delta_energy_vs_energy_->Fill(oc.energy() - ic.energy(), ic.energy()); + histo.delta_energy_vs_layer_->Fill(layer_in, oc.energy() - ic.energy()); + histo.delta_energy_relative_vs_layer_->Fill(layer_in, (oc.energy() - ic.energy()) / ic.energy()); + histo.delta_layer_->Fill(layer_out - layer_in); + + // Alpha angles + const auto& outer_outer_pos = oc.position(); + const auto& outer_inner_pos = ic.position(); + const auto& seed = thisTrackster.seedIndex(); + auto seedGlobalPos = math::XYZPoint( + ticlSeedingGlobal[0].origin.x(), ticlSeedingGlobal[0].origin.y(), ticlSeedingGlobal[0].origin.z()); + auto seedDirectionPos = outer_inner_pos; + if (thisTrackster.seedID().id() != 0) { + // Seed to trackster association is, at present, rather convoluted. + for (auto const& s : ticlSeedingTrk) { + if (s.index == seed) { + seedGlobalPos = math::XYZPoint(s.origin.x(), s.origin.y(), s.origin.z()); + seedDirectionPos = + math::XYZPoint(s.directionAtOrigin.x(), s.directionAtOrigin.y(), s.directionAtOrigin.z()); + break; + } + } + } + + auto alpha = (outer_inner_pos - seedGlobalPos).Dot(outer_outer_pos - outer_inner_pos) / + sqrt((outer_inner_pos - seedGlobalPos).Mag2() * (outer_outer_pos - outer_inner_pos).Mag2()); + auto alpha_alternative = (outer_outer_pos - seedGlobalPos).Dot(seedDirectionPos) / + sqrt((outer_outer_pos - seedGlobalPos).Mag2() * seedDirectionPos.Mag2()); + histo.angle_alpha_->Fill(alpha); + histo.angle_alpha_alternative_->Fill(alpha_alternative); + + // Beta angle is usually computed using 2 edges. Another inner loop + // is therefore needed. + std::vector> innerDoublets; + std::vector> outerDoublets; + for (const auto& otherEdge : thisTrackster.edges()) { + if (otherEdge[1] == edge[0]) { + innerDoublets.push_back(otherEdge); + } + if (edge[1] == otherEdge[0]) { + outerDoublets.push_back(otherEdge); + } + } + + histo.ingoing_links_vs_layer_->Fill(layer_in, innerDoublets.size()); + histo.outgoing_links_vs_layer_->Fill(layer_out, outerDoublets.size()); + for (const auto& inner : innerDoublets) { + const auto& inner_ic = layerClusters[inner[0]]; + const auto& inner_inner_pos = inner_ic.position(); + auto beta = (outer_inner_pos - inner_inner_pos).Dot(outer_outer_pos - inner_inner_pos) / + sqrt((outer_inner_pos - inner_inner_pos).Mag2() * (outer_outer_pos - inner_inner_pos).Mag2()); + histo.angle_beta_->Fill(beta); + histo.angle_beta_byLayer_[layer_in]->Fill(beta); + histo.angle_beta_w_byLayer_[layer_in]->Fill(beta, ic.energy()); + } + } + } + } +} + +void TICLTrackstersEdgesValidation::bookHistograms(DQMStore::IBooker& ibook, + edm::Run const& run, + edm::EventSetup const& iSetup, + Histograms_TICLTrackstersEdgesValidation& histos) const { + float eMin = 0., eThresh = 70., eMax = 500; + float eWidth[] = {0.5, 2.}; + std::vector eBins; + float eVal = eMin; + while (eVal <= eThresh) { + eBins.push_back(eVal); + eVal += eWidth[0]; + } + while (eVal < eMax) { + eVal += eWidth[1]; + eBins.push_back(eVal); + } + int eNBins = eBins.size() - 1; + + TString onePlusLC[] = {"1plus LC", "for tracksters with at least one LC"}; + TString trkers = "Tracksters"; + static const char* particle_kind[] = { + "photon", "electron", "muon", "neutral_pion", "charged_hadron", "neutral_hadron", "ambiguous", "unknown"}; + auto nCategory = sizeof(particle_kind) / sizeof(*particle_kind); + int labelIndex = 0; + for (const auto& trackster_token : tracksterTokens_) { + auto& histo = histos[trackster_token.index()]; + ibook.setCurrentFolder(folder_ + "HGCalValidator/" + trackstersCollectionsNames_[labelIndex]); + histo.number_ = ibook.book1D( + "Number of Tracksters per Event", "Number of Tracksters per Event;# Tracksters;Events", 250, 0., 250.); + // The following plots should be moved to HGVHistoProducerAlgo + // when we get rid of the MultiClusters and use only Tracksters + histo.raw_energy_ = ibook.book1D("Raw Energy", "Raw Energy;Raw Energy [GeV];" + trkers, eNBins, &eBins[0]); + histo.regr_energy_ = + ibook.book1D("Regressed Energy", "Regressed Energy;Regressed Energy [GeV];" + trkers, eNBins, &eBins[0]); + histo.raw_energy_vs_regr_energy_ = ibook.book2D("Raw Energy vs Regressed Energy", + "Raw vs Regressed Energy;Regressed Energy [GeV];Raw Energy [GeV]", + eNBins, + &eBins[0], + eNBins, + &eBins[0]); + histo.id_prob_ = + ibook.book1D("ID probability", "ID probability;category;Max ID probability", nCategory, 0, nCategory); + histo.raw_energy_1plusLC_ = ibook.book1D( + "Raw Energy " + onePlusLC[0], "Raw Energy " + onePlusLC[1] + ";Raw Energy [GeV];" + trkers, eNBins, &eBins[0]); + histo.regr_energy_1plusLC_ = ibook.book1D("Regressed Energy " + onePlusLC[0], + "Regressed Energy " + onePlusLC[1] + ";Regressed Energy [GeV];" + trkers, + eNBins, + &eBins[0]); + histo.raw_energy_vs_regr_energy_1plusLC_ = + ibook.book2D("Raw Energy vs Regressed Energy " + onePlusLC[0], + "Raw vs Regressed Energy " + onePlusLC[1] + ";Regressed Energy [GeV];Raw Energy [GeV]", + eNBins, + &eBins[0], + eNBins, + &eBins[0]); + histo.id_prob_1plusLC_ = ibook.book1D("ID probability " + onePlusLC[0], + "ID probability " + onePlusLC[1] + ";category;Max ID probability", + nCategory, + 0, + nCategory); + for (int iBin = 0; iBin < histo.id_prob_->getNbinsX(); iBin++) { + histo.id_prob_->setBinLabel(iBin + 1, particle_kind[iBin]); + histo.id_prob_1plusLC_->setBinLabel(iBin + 1, particle_kind[iBin]); + } + // Plots on edges + histo.delta_energy_ = ibook.book1D("Delta energy", "Delta Energy (O-I)", 800, -20., 20.); + histo.delta_energy_relative_ = + ibook.book1D("Relative Delta energy", "Relative Delta Energy (O-I)/I", 200, -10., 10.); + histo.delta_energy_vs_energy_ = + ibook.book2D("Energy vs Delta Energy", "Energy (I) vs Delta Energy (O-I)", 800, -20., 20., 200, 0., 20.); + histo.delta_energy_vs_layer_ = ibook.book2D( + "Delta Energy (O-I) vs Layer Number (I)", "Delta Energy (O-I) vs Layer Number (I)", 50, 0., 50., 800, -20., 20.); + histo.delta_energy_relative_vs_layer_ = ibook.book2D("Relative Delta Energy (O-I)_I vs Layer Number (I)", + "Relative Delta Energy (O-I)_I vs Layer Number (I)", + 50, + 0., + 50., + 200, + -10., + 10.); + histo.ingoing_links_vs_layer_ = + ibook.book2D("Ingoing links Layer Number", "Ingoing links vs Layer Number", 50, 0., 50., 40, 0., 40.); + histo.outgoing_links_vs_layer_ = + ibook.book2D("Outgoing links vs Layer Number", "Outgoing links vs Layer Number", 50, 0., 50., 40, 0., 40.); + histo.delta_layer_ = ibook.book1D("Delta Layer", "Delta Layer", 10, 0., 10.); + histo.angle_alpha_ = ibook.book1D("cosAngle Alpha", "cosAngle Alpha", 200, -1., 1.); + histo.angle_beta_ = ibook.book1D("cosAngle Beta", "cosAngle Beta", 200, -1., 1.); + histo.angle_alpha_alternative_ = ibook.book1D("cosAngle Alpha Alternative", "Angle Alpha Alternative", 200, 0., 1.); + for (int layer = 0; layer < 50; layer++) { + auto layerstr = std::to_string(layer + 1); + if (layerstr.length() < 2) + layerstr.insert(0, 2 - layerstr.length(), '0'); + histo.angle_beta_byLayer_.push_back( + ibook.book1D("cosAngle Beta on Layer " + layerstr, "cosAngle Beta on Layer " + layerstr, 200, -1., 1.)); + histo.angle_beta_w_byLayer_.push_back(ibook.book1D( + "cosAngle Beta Weighted on Layer " + layerstr, "cosAngle Beta Weighted on Layer " + layerstr, 200, -1., 1.)); + } + labelIndex++; + } +} + +void TICLTrackstersEdgesValidation::dqmBeginRun(edm::Run const& run, + edm::EventSetup const& iSetup, + Histograms_TICLTrackstersEdgesValidation& histograms) const { + edm::ESHandle geom = iSetup.getHandle(caloGeomToken_); + rhtools_.setGeometry(*geom); +} + +void TICLTrackstersEdgesValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector source_vector{edm::InputTag("ticlTrackstersTrk"), + edm::InputTag("ticlTrackstersTrkEM"), + edm::InputTag("ticlTrackstersEM"), + edm::InputTag("ticlTrackstersHAD"), + edm::InputTag("ticlTrackstersMerge")}; + desc.add>("tracksterCollections", source_vector); + desc.add("layerClusters", edm::InputTag("hgcalLayerClusters")); + desc.add("ticlSeedingGlobal", edm::InputTag("ticlSeedingGlobal")); + desc.add("ticlSeedingTrk", edm::InputTag("ticlSeedingTrk")); + desc.add("folder", "HGCAL/"); + descriptions.add("ticlTrackstersEdgesValidationDefault", desc); +} + +DEFINE_FWK_MODULE(TICLTrackstersEdgesValidation); diff --git a/Validation/HGCalValidation/python/CaloParticleSelectionForEfficiency_cfi.py b/Validation/HGCalValidation/python/CaloParticleSelectionForEfficiency_cfi.py index f3e9667d8c40f..5e84ad75752b6 100644 --- a/Validation/HGCalValidation/python/CaloParticleSelectionForEfficiency_cfi.py +++ b/Validation/HGCalValidation/python/CaloParticleSelectionForEfficiency_cfi.py @@ -2,7 +2,7 @@ CaloParticleSelectionForEfficiency = cms.PSet( ptMinCP = cms.double(0.5), - ptMaxCP = cms.double(250.), + ptMaxCP = cms.double(300.), minRapidityCP = cms.double(-3.1), maxRapidityCP = cms.double(3.1), #--z position of the origin vertex less than lipCP diff --git a/Validation/HGCalValidation/python/HGCalValidator_cfi.py b/Validation/HGCalValidation/python/HGCalValidator_cfi.py index 8a6925bcb1f6d..4f415db769eaa 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cfi.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cfi.py @@ -7,6 +7,13 @@ from SimCalorimetry.HGCalAssociatorProducers.LCToSCAssociation_cfi import layerClusterSimClusterAssociation from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabelsMerge + +labelMcl = [cms.InputTag("ticlMultiClustersFromTracksters"+iteration) for iteration in ticlIterLabelsMerge] +labelMcl.extend(["ticlMultiClustersFromSimTracksters"]) +lcInputMask = [cms.InputTag("ticlTracksters"+iteration) for iteration in ticlIterLabels] +lcInputMask.extend(["ticlSimTracksters"]) hgcalValidator = DQMEDAnalyzer( "HGCalValidator", @@ -17,12 +24,7 @@ ### reco input configuration ### #2dlayerclusters, pfclusters, multiclusters label_lcl = layerClusterCaloParticleAssociation.label_lc, - label_mcl = cms.VInputTag( - cms.InputTag("ticlMultiClustersFromTrackstersTrk"), - cms.InputTag("ticlMultiClustersFromTrackstersTrkEM"), - cms.InputTag("ticlMultiClustersFromTrackstersEM"), - cms.InputTag("ticlMultiClustersFromTrackstersHAD"), - cms.InputTag("ticlMultiClustersFromTrackstersMerge")), + label_mcl = cms.VInputTag(labelMcl), associator = cms.untracked.InputTag("layerClusterCaloParticleAssociationProducer"), @@ -35,11 +37,11 @@ #Select caloParticles for efficiency or pass through doCaloParticleSelection = cms.untracked.bool(True), #SimCluster related plots - dosimclustersPlots = cms.untracked.bool(True), + doSimClustersPlots = cms.untracked.bool(True), #Layer Cluster related plots - dolayerclustersPlots = cms.untracked.bool(True), + doLayerClustersPlots = cms.untracked.bool(True), #Multi Cluster related plots - domulticlustersPlots = cms.untracked.bool(True), + doMultiClustersPlots = cms.untracked.bool(True), #The cumulative material budget in front of each layer. To be more specific, it #is the material budget just in front of the active material (not including it). @@ -54,12 +56,7 @@ simVertices = cms.InputTag("g4SimHits"), - LayerClustersInputMask = cms.VInputTag( - cms.InputTag("ticlTrackstersTrkEM"), - cms.InputTag("ticlTrackstersEM"), - cms.InputTag("ticlTrackstersTrk"), - cms.InputTag("ticlTrackstersHAD") - ), + LayerClustersInputMask = cms.VInputTag(lcInputMask), #Total number of layers of HGCal that we want to monitor #Could get this also from HGCalImagingAlgo::maxlayer but better to get it from here diff --git a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py index 495e05e91d9a9..c138c5f07aa5d 100644 --- a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py +++ b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabelsMerge maxlayerzm = 50# last layer of BH -z maxlayerzp = 100# last layer of BH +z @@ -33,14 +34,10 @@ eff_simclusters.extend(["merge_eta_layer{:02d} 'LayerCluster Merge Rate vs #eta Layer{:02d} in z-' NumMerge_LayerCluster_in_SimCluster_Eta_perlayer{:02d} Denom_LayerCluster_in_SimCluster_Eta_perlayer{:02d}".format(i, i%maxlayerzm+1, i, i) if (i totenergy_layer; for (auto const& sc : caloparticle.simClusters()) { + LogDebug("HGCalValidator") << " This sim cluster has " << sc->hits_and_fractions().size() << " simHits and " + << sc->energy() << " energy. " << std::endl; simHits += sc->hits_and_fractions().size(); - for (auto const& h_and_f : sc->hits_and_fractions()) { const auto hitDetId = h_and_f.first; int layerId = recHitTools_->getLayerWithOffset(hitDetId) + layers * ((recHitTools_->zside(hitDetId) + 1) >> 1) - 1; - // set to 0 if matched RecHit not found int layerId_matched_min = 999; int layerId_matched_max = 0; @@ -1279,6 +1285,8 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms if (caloparticle.simClusters().size() == 1) histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl.at(pdgid)->Fill(layerId, hit->energy() * h_and_f.second); + } else { + LogDebug("HGCalValidator") << " matched to RecHit NOT found !" << std::endl; } minLayerId = std::min(minLayerId, layerId); @@ -1286,6 +1294,7 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms minLayerId_matched = std::min(minLayerId_matched, layerId_matched_min); maxLayerId_matched = std::max(maxLayerId_matched, layerId_matched_max); } + LogDebug("HGCalValidator") << std::endl; } histograms.h_caloparticle_firstlayer.at(pdgid)->Fill(minLayerId); histograms.h_caloparticle_lastlayer.at(pdgid)->Fill(maxLayerId); @@ -2817,6 +2826,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist multiClusters[bestmclId].energy() / CPenergy); histograms.h_sharedenergy_caloparticle2multicl_vs_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi(), multiClusters[bestmclId].energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2multicl_assoc[count]->Fill(mclsharedenergyfrac[cpId][bestmclId]); } if (assocDup >= 2) { auto match = std::find_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); diff --git a/Validation/HGCalValidation/test/python/standalone_onlyTICL_HARVESTING.py b/Validation/HGCalValidation/test/python/standalone_onlyTICL_HARVESTING.py new file mode 100644 index 0000000000000..1757bbf971e39 --- /dev/null +++ b/Validation/HGCalValidation/test/python/standalone_onlyTICL_HARVESTING.py @@ -0,0 +1,98 @@ +# Configuration file to run HGCAL Validator only +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 + +options = VarParsing.VarParsing ('standard') +options.register('inputFile', 'step3_inDQM.root', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Input file") +options.register ('globalTag', 'auto:phase2_realistic_T15', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "GlobalTag") +options.parseArguments() + +print("Input file: ", options.inputFile) +print("GlobalTag: ", options.globalTag) + +process = cms.Process('HARVESTING',Phase2C9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff') +process.load('Configuration.StandardSequences.Harvesting_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(100), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("DQMRootSource", + fileNames = cms.untracked.vstring('file:'+options.inputFile) +) + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring('ProductNotFound'), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('step4 nevts:100'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +# Additional output definition + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '') + +# Path and EndPath definitions +process.hgcalValidatorPostProcessor_step = cms.Path(process.hgcalValidatorPostProcessor) +process.dqmsave_step = cms.Path(process.DQMSaver) + +# Schedule definition +process.schedule = cms.Schedule(process.hgcalValidatorPostProcessor_step,process.dqmsave_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Validation/HGCalValidation/test/python/standalone_onlyTICL_fromRECO.py b/Validation/HGCalValidation/test/python/standalone_onlyTICL_fromRECO.py new file mode 100644 index 0000000000000..d7cb239f94ff1 --- /dev/null +++ b/Validation/HGCalValidation/test/python/standalone_onlyTICL_fromRECO.py @@ -0,0 +1,154 @@ +# Configuration file to run only TICL on an already existing step3.root file +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 + +options = VarParsing.VarParsing ('standard') +options.register('inputFile', 'step3.root', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Input file") +options.register('outputFile', 'step3_reReco_ticlOnly.root', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Output file") +options.register ('globalTag', 'auto:phase2_realistic_T15', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "GlobalTag") +options.parseArguments() + +print("Input file: ", options.inputFile) +print("Output file: ", options.outputFile) +print("GlobalTag: ", options.globalTag) + +process = cms.Process('TICL',Phase2C9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.L1Reco_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') +process.load('Configuration.StandardSequences.RecoSim_cff') +process.load('Configuration.StandardSequences.Validation_cff') +process.load('DQMServices.Core.DQMStoreNonLegacy_cff') +process.load('DQMOffline.Configuration.DQMOfflineMC_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:'+options.inputFile), + secondaryFileNames = cms.untracked.vstring() +) +process.source.duplicateCheckMode = cms.untracked.string('noDuplicateCheck') + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('step3 nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.ticl_FEVToutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM-RECO'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:'+options.outputFile), + outputCommands = cms.untracked.vstring( ( + 'drop *', + 'keep *_HGCalRecHit_*_*', + 'keep recoCaloClusters_hgcalLayerClusters_*_*', + 'keep *_hgcalLayerClusters_timeLayerCluster_*', + 'keep *_hgcalLayerClusters_InitialLayerClustersMask_*', + 'keep *_hgcalMultiClusters_*_*', + 'keep *_iterHGCalMultiClusters_*_*', + 'keep *_ticlTracksters*_*_*', + 'keep *_ticlSimTracksters*_*_*', + 'keep *_ticlMultiClustersFromTracksters*_*_*', + 'keep *_ticlMultiClustersFromSimTracksters*_*_*', + 'keep *_genParticle*_*_*', + 'keep *_generator_*_*', + 'keep *_mix*_MergedCaloTruth_*', + 'keep *_genPUProtons_*_*', + ) ), + splitLevel = cms.untracked.int32(0) +) + +process.DQMoutput = cms.OutputModule("DQMRootOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('DQMIO'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step3_inDQM.root'), + outputCommands = process.DQMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '') + +process.ticl_seq = cms.Sequence( + process.iterTICLTask +) + +process.ticl_step = cms.Path(process.ticl_seq) +process.ticl_prevalidation_step = cms.Path(process.globalPrevalidationHGCal) +process.ticl_validation = cms.Sequence(process.hgcalLayerClusters+process.hgcalRecHitMapProducer+process.hgcalValidatorSequence) +process.ticl_validation_step = cms.EndPath(process.ticl_validation) +process.ticl_FEVToutput_step = cms.EndPath(process.ticl_FEVToutput) +process.DQMoutput_step = cms.EndPath(process.DQMoutput) + +# Schedule definition +process.schedule = cms.Schedule( + process.ticl_step, + process.ticl_prevalidation_step, + process.ticl_validation_step, + process.ticl_FEVToutput_step, + process.DQMoutput_step) + +# customisation of the process. + +# Customisation from command line + +#Have logErrorHarvester wait for the same EDProducers to finish as those providing data for the OutputModule +from FWCore.Modules.logErrorHarvester_cff import customiseLogErrorHarvesterUsingOutputCommands +process = customiseLogErrorHarvesterUsingOutputCommands(process) + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Validation/MtdValidation/plugins/BtlDigiHitsValidation.cc b/Validation/MtdValidation/plugins/BtlDigiHitsValidation.cc index de9b19ec186ba..8afa5e82c75d2 100644 --- a/Validation/MtdValidation/plugins/BtlDigiHitsValidation.cc +++ b/Validation/MtdValidation/plugins/BtlDigiHitsValidation.cc @@ -54,6 +54,9 @@ class BtlDigiHitsValidation : public DQMEDAnalyzer { edm::EDGetTokenT btlDigiHitsToken_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; + // --- histograms declaration MonitorElement* meNhits_[2]; @@ -89,6 +92,8 @@ BtlDigiHitsValidation::BtlDigiHitsValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter("folder")), LocalPosDebug_(iConfig.getParameter("LocalPositionDebug")) { btlDigiHitsToken_ = consumes(iConfig.getParameter("inputTag")); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); } BtlDigiHitsValidation::~BtlDigiHitsValidation() {} @@ -97,12 +102,10 @@ BtlDigiHitsValidation::~BtlDigiHitsValidation() {} void BtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); + auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_); const MTDGeometry* geom = geometryHandle.product(); - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); auto btlDigiHitsHandle = makeValid(iEvent.getHandle(btlDigiHitsToken_)); diff --git a/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc b/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc index aa39b29fd4662..ab50036cc1115 100644 --- a/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc +++ b/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc @@ -71,6 +71,9 @@ class BtlLocalRecoValidation : public DQMEDAnalyzer { edm::EDGetTokenT > btlSimHitsToken_; edm::EDGetTokenT btlRecCluToken_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; + // --- histograms declaration MonitorElement* meNhits_; @@ -130,6 +133,8 @@ BtlLocalRecoValidation::BtlLocalRecoValidation(const edm::ParameterSet& iConfig) btlRecHitsToken_ = consumes(iConfig.getParameter("recHitsTag")); btlSimHitsToken_ = consumes >(iConfig.getParameter("simHitsTag")); btlRecCluToken_ = consumes(iConfig.getParameter("recCluTag")); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); } BtlLocalRecoValidation::~BtlLocalRecoValidation() {} @@ -140,12 +145,10 @@ void BtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS using namespace std; using namespace geant_units::operators; - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); + auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_); const MTDGeometry* geom = geometryHandle.product(); - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); auto btlRecHitsHandle = makeValid(iEvent.getHandle(btlRecHitsToken_)); diff --git a/Validation/MtdValidation/plugins/BtlSimHitsValidation.cc b/Validation/MtdValidation/plugins/BtlSimHitsValidation.cc index df79b661a9114..5cc65466e0ffa 100644 --- a/Validation/MtdValidation/plugins/BtlSimHitsValidation.cc +++ b/Validation/MtdValidation/plugins/BtlSimHitsValidation.cc @@ -66,6 +66,9 @@ class BtlSimHitsValidation : public DQMEDAnalyzer { edm::EDGetTokenT > btlSimHitsToken_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; + // --- histograms declaration MonitorElement* meNevents_; @@ -103,6 +106,8 @@ BtlSimHitsValidation::BtlSimHitsValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter("folder")), hitMinEnergy_(iConfig.getParameter("hitMinimumEnergy")) { btlSimHitsToken_ = consumes >(iConfig.getParameter("inputTag")); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); } BtlSimHitsValidation::~BtlSimHitsValidation() {} @@ -112,12 +117,10 @@ void BtlSimHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSet using namespace edm; using namespace geant_units::operators; - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); + auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_); const MTDGeometry* geom = geometryHandle.product(); - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); auto btlSimHitsHandle = makeValid(iEvent.getHandle(btlSimHitsToken_)); diff --git a/Validation/MtdValidation/plugins/EtlDigiHitsValidation.cc b/Validation/MtdValidation/plugins/EtlDigiHitsValidation.cc index 3a31ea77dbceb..099adcb6879c5 100644 --- a/Validation/MtdValidation/plugins/EtlDigiHitsValidation.cc +++ b/Validation/MtdValidation/plugins/EtlDigiHitsValidation.cc @@ -50,6 +50,9 @@ class EtlDigiHitsValidation : public DQMEDAnalyzer { edm::EDGetTokenT etlDigiHitsToken_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; + // --- histograms declaration MonitorElement* meNhits_[4]; @@ -81,6 +84,8 @@ EtlDigiHitsValidation::EtlDigiHitsValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter("folder")), LocalPosDebug_(iConfig.getParameter("LocalPositionDebug")) { etlDigiHitsToken_ = consumes(iConfig.getParameter("inputTag")); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); } EtlDigiHitsValidation::~EtlDigiHitsValidation() {} @@ -89,8 +94,10 @@ EtlDigiHitsValidation::~EtlDigiHitsValidation() {} void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_); + const MTDGeometry* geom = geometryHandle.product(); + + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); bool topo1Dis = false; @@ -102,10 +109,6 @@ void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSe topo2Dis = true; } - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); - const MTDGeometry* geom = geometryHandle.product(); - auto etlDigiHitsHandle = makeValid(iEvent.getHandle(etlDigiHitsToken_)); // --- Loop over the ETL DIGI hits diff --git a/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc b/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc index 9d69904cf54ee..108bfdf2537c0 100644 --- a/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc +++ b/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc @@ -68,6 +68,9 @@ class EtlLocalRecoValidation : public DQMEDAnalyzer { edm::EDGetTokenT > etlSimHitsToken_; edm::EDGetTokenT etlRecCluToken_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; + // --- histograms declaration MonitorElement* meNhits_[4]; @@ -116,6 +119,8 @@ EtlLocalRecoValidation::EtlLocalRecoValidation(const edm::ParameterSet& iConfig) etlRecHitsToken_ = consumes(iConfig.getParameter("recHitsTag")); etlSimHitsToken_ = consumes >(iConfig.getParameter("simHitsTag")); etlRecCluToken_ = consumes(iConfig.getParameter("recCluTag")); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); } EtlLocalRecoValidation::~EtlLocalRecoValidation() {} @@ -126,8 +131,10 @@ void EtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS using namespace std; using namespace geant_units::operators; - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_); + const MTDGeometry* geom = geometryHandle.product(); + + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); bool topo1Dis = false; @@ -139,10 +146,6 @@ void EtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS topo2Dis = true; } - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); - const MTDGeometry* geom = geometryHandle.product(); - auto etlRecHitsHandle = makeValid(iEvent.getHandle(etlRecHitsToken_)); auto etlSimHitsHandle = makeValid(iEvent.getHandle(etlSimHitsToken_)); auto etlRecCluHandle = makeValid(iEvent.getHandle(etlRecCluToken_)); diff --git a/Validation/MtdValidation/plugins/EtlSimHitsValidation.cc b/Validation/MtdValidation/plugins/EtlSimHitsValidation.cc index c2b2a9ace9bb6..861ff493a0cf3 100644 --- a/Validation/MtdValidation/plugins/EtlSimHitsValidation.cc +++ b/Validation/MtdValidation/plugins/EtlSimHitsValidation.cc @@ -62,6 +62,9 @@ class EtlSimHitsValidation : public DQMEDAnalyzer { edm::EDGetTokenT > etlSimHitsToken_; + edm::ESGetToken mtdgeoToken_; + edm::ESGetToken mtdtopoToken_; + // --- histograms declaration MonitorElement* meNhits_[4]; @@ -95,6 +98,8 @@ EtlSimHitsValidation::EtlSimHitsValidation(const edm::ParameterSet& iConfig) hitMinEnergy1Dis_(iConfig.getParameter("hitMinimumEnergy1Dis")), hitMinEnergy2Dis_(iConfig.getParameter("hitMinimumEnergy2Dis")) { etlSimHitsToken_ = consumes >(iConfig.getParameter("inputTag")); + mtdgeoToken_ = esConsumes(); + mtdtopoToken_ = esConsumes(); } EtlSimHitsValidation::~EtlSimHitsValidation() {} @@ -104,12 +109,10 @@ void EtlSimHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSet using namespace edm; using namespace geant_units::operators; - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); + auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_); const MTDGeometry* geom = geometryHandle.product(); - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); bool topo1Dis = false; diff --git a/Validation/MtdValidation/plugins/MtdTracksValidation.cc b/Validation/MtdValidation/plugins/MtdTracksValidation.cc index 875cdac29d667..2ae95a5fc1a59 100644 --- a/Validation/MtdValidation/plugins/MtdTracksValidation.cc +++ b/Validation/MtdValidation/plugins/MtdTracksValidation.cc @@ -68,6 +68,8 @@ class MtdTracksValidation : public DQMEDAnalyzer { edm::EDGetTokenT> Sigmat0SafePidToken_; edm::EDGetTokenT> trackMVAQualToken_; + edm::ESGetToken mtdtopoToken_; + MonitorElement* meBTLTrackRPTime_; MonitorElement* meBTLTrackEffEtaTot_; MonitorElement* meBTLTrackEffPhiTot_; @@ -122,6 +124,7 @@ MtdTracksValidation::MtdTracksValidation(const edm::ParameterSet& iConfig) t0SafePidToken_ = consumes>(iConfig.getParameter("t0SafePID")); Sigmat0SafePidToken_ = consumes>(iConfig.getParameter("sigmat0SafePID")); trackMVAQualToken_ = consumes>(iConfig.getParameter("trackMVAQual")); + mtdtopoToken_ = esConsumes(); } MtdTracksValidation::~MtdTracksValidation() {} @@ -132,8 +135,7 @@ void MtdTracksValidation::analyze(const edm::Event& iEvent, const edm::EventSetu using namespace geant_units::operators; using namespace std; - edm::ESHandle topologyHandle; - iSetup.get().get(topologyHandle); + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); const MTDTopology* topology = topologyHandle.product(); bool topo1Dis = false; diff --git a/Validation/MuonCSCDigis/src/CSCALCTDigiValidation.cc b/Validation/MuonCSCDigis/src/CSCALCTDigiValidation.cc index 853877c5a04da..79fddd684a516 100644 --- a/Validation/MuonCSCDigis/src/CSCALCTDigiValidation.cc +++ b/Validation/MuonCSCDigis/src/CSCALCTDigiValidation.cc @@ -16,13 +16,12 @@ CSCALCTDigiValidation::CSCALCTDigiValidation(const edm::ParameterSet &ps, edm::C CSCALCTDigiValidation::~CSCALCTDigiValidation() {} void CSCALCTDigiValidation::bookHistograms(DQMStore::IBooker &iBooker) { - theNDigisPerEventPlot = - iBooker.book1D("CSCALCTDigisPerEvent", "ALCT Digis per event; Number of ALCTs; Entries", 4, 0, 4); + theNDigisPerEventPlot = iBooker.book1D( + "CSCALCTDigisPerEvent", "ALCT trigger primitives per event; Number of ALCTs; Entries", 100, 0, 100); for (int i = 1; i <= 10; ++i) { const std::string t1("CSCALCTDigiTime_" + CSCDetId::chamberName(i)); const std::string t2("CSCALCTDigisPerChamber_" + CSCDetId::chamberName(i)); - theTimeBinPlots[i - 1] = - iBooker.book1D(t1, "Wire Time Bin " + CSCDetId::chamberName(i) + ";Wire Time Bin; Entries", 16, 0, 16); + theTimeBinPlots[i - 1] = iBooker.book1D(t1, "ALCT BX " + CSCDetId::chamberName(i) + ";ALCT BX; Entries", 16, 0, 16); theNDigisPerChamberPlots[i - 1] = iBooker.book1D( t2, "Number of ALCTs per chamber " + CSCDetId::chamberName(i) + ";Number of ALCTs per chamber;Entries", 4, 0, 4); } diff --git a/Validation/MuonCSCDigis/src/CSCCLCTDigiValidation.cc b/Validation/MuonCSCDigis/src/CSCCLCTDigiValidation.cc index 779b7659a5efa..5d11ecf8830c6 100644 --- a/Validation/MuonCSCDigis/src/CSCCLCTDigiValidation.cc +++ b/Validation/MuonCSCDigis/src/CSCCLCTDigiValidation.cc @@ -16,13 +16,12 @@ CSCCLCTDigiValidation::CSCCLCTDigiValidation(const edm::ParameterSet &ps, edm::C CSCCLCTDigiValidation::~CSCCLCTDigiValidation() {} void CSCCLCTDigiValidation::bookHistograms(DQMStore::IBooker &iBooker) { - theNDigisPerEventPlot = - iBooker.book1D("CSCCLCTDigisPerEvent", "CLCT Digis per event; Number of CLCTs; Entries", 4, 0, 4); + theNDigisPerEventPlot = iBooker.book1D( + "CSCCLCTDigisPerEvent", "CLCT trigger primitives per event; Number of CLCTs; Entries", 100, 0, 100); for (int i = 1; i <= 10; ++i) { const std::string t1("CSCCLCTDigiTime_" + CSCDetId::chamberName(i)); const std::string t2("CSCCLCTDigisPerChamber_" + CSCDetId::chamberName(i)); - theTimeBinPlots[i - 1] = iBooker.book1D( - t1, "Comparator Time Bin " + CSCDetId::chamberName(i) + ";Comparator Time Bin; Entries", 16, 0, 16); + theTimeBinPlots[i - 1] = iBooker.book1D(t1, "CLCT BX " + CSCDetId::chamberName(i) + ";CLCT BX; Entries", 16, 0, 16); theNDigisPerChamberPlots[i - 1] = iBooker.book1D( t2, "Number of CLCTs per chamber " + CSCDetId::chamberName(i) + ";Number of CLCTs per chamber;Entries", 4, 0, 4); } diff --git a/Validation/MuonCSCDigis/src/CSCStubMatcher.cc b/Validation/MuonCSCDigis/src/CSCStubMatcher.cc index c50d1b773b6d5..046fe1757b1b4 100644 --- a/Validation/MuonCSCDigis/src/CSCStubMatcher.cc +++ b/Validation/MuonCSCDigis/src/CSCStubMatcher.cc @@ -1,5 +1,5 @@ #include "Validation/MuonCSCDigis/interface/CSCStubMatcher.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include using namespace std; @@ -95,7 +95,7 @@ void CSCStubMatcher::matchCLCTsToSimTrack(const CSCCLCTDigiCollection& clcts) { // get the comparator digis in this chamber std::vector comps; - for (int ilayer = 1; ilayer <= 6; ilayer++) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ilayer++) { CSCDetId layerid(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), ilayer); comps.push_back(cscDigiMatcher_->comparatorDigisInDetId(layerid)); } @@ -640,7 +640,7 @@ GlobalPoint CSCStubMatcher::getGlobalPosition(unsigned int rawId, const CSCCorre float fractional_strip = lct.getFractionalStrip(); // case ME1/a if (cscId.station() == 1 and cscId.ring() == 4 and lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B) { - fractional_strip -= CSCConstants::MAX_NUM_STRIPS_ME1B; + fractional_strip -= CSCConstants::NUM_STRIPS_ME1B; } // regular cases const auto& chamber = cscGeometry_->chamber(cscId); diff --git a/Validation/RecoTrack/python/plotting/plotting.py b/Validation/RecoTrack/python/plotting/plotting.py index db39adce17885..e09b6530e6c5d 100644 --- a/Validation/RecoTrack/python/plotting/plotting.py +++ b/Validation/RecoTrack/python/plotting/plotting.py @@ -1967,10 +1967,11 @@ def _doStats(h, col, dy): if self._fit: st.SetOptFit(0o010) st.SetOptStat(1001) + st.SetOptStat(1110) st.SetX1NDC(startingX) st.SetX2NDC(startingX+0.3) st.SetY1NDC(startingY+dy) - st.SetY2NDC(startingY+dy+0.15) + st.SetY2NDC(startingY+dy+0.12) st.SetTextColor(col) dy = 0.0 @@ -1979,7 +1980,7 @@ def _doStats(h, col, dy): dy += self._statyadjust[i] _doStats(h, _plotStylesColor[i], dy) - dy -= 0.19 + dy -= 0.16 def _normalize(self): """Normalise histograms to unit area"""